Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* These are functions specific to this theme */
- /*
- * Scripts and Header
- */
- function clean_header(){
- // CLEAN UP HEADER
- remove_action( 'wp_head', 'wlwmanifest_link'); // Remvoes link for Windows Live Writer users
- remove_action( 'wp_head', 'wp_generator'); // Removes WP version
- remove_action( 'wp_head', 'rsd_link' ); // Removes unneeded Really Simple Discovery link
- remove_action( 'wp_head', 'start_post_rel_link'); //Remove relational start link
- remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head'); // Remove prev/next relational links
- }
- add_action('init','clean_header');
- // Add the Contact Form 7 scripts only on the contact page
- function deregister_cf7_js() {
- if ( !is_page('contact')) {
- wp_deregister_script( 'contact-form-7');
- }
- }
- add_action( 'wp_print_scripts', 'deregister_cf7_js' );
- function deregister_ct7_styles() {
- wp_deregister_style( 'contact-form-7');
- }
- add_action( 'wp_print_styles', 'deregister_ct7_styles');
- //remove bundled wp-pagenavi css
- function my_deregister_styles() {
- wp_deregister_style( 'wp-pagenavi' );
- }
- add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
- /* MU Specific Function to Determine Actual Image Path */
- if(!function_exists('get_mu_image_path')){
- function get_mu_image_path($img_src) {
- global $blog_id;
- if (isset($blog_id) && $blog_id > 0) {
- $imageParts = explode('/files/', $img_src);
- if (isset($imageParts[1])) {
- $img_src = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
- }
- }
- return $img_src;
- }
- }
- /*
- * ADD THUMBNAIL IN POST/PAGE OVERVIEW
- */
- if ( !function_exists('fb_AddThumbColumn') && function_exists('add_theme_support') ) {
- // for post and page
- add_theme_support('post-thumbnails', array( 'post', 'page' ) );
- function fb_AddThumbColumn($cols) {
- //$cols['thumbnail'] = __('Thumbnail');
- $part1=array_slice($cols,0,2);
- $part2=array_slice($cols,2);
- $part1['thumbnail']=__('Thumbnail');
- $cols=array_merge($part1,$part2);
- return $cols;
- }
- function fb_AddThumbValue($column_name, $post_id) {
- $width = (int) 35;
- $height = (int) 35;
- if ( 'thumbnail' == $column_name ) {
- // thumbnail of WP 2.9
- $thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
- // image from gallery
- $attachments = get_children( array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image') );
- if ($thumbnail_id)
- $thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true );
- elseif ($attachments) {
- foreach ( $attachments as $attachment_id => $attachment ) {
- $thumb = wp_get_attachment_image( $attachment_id, array($width, $height), true );
- }
- }
- if ( isset($thumb) && $thumb ) {
- echo $thumb;
- } else {
- echo __('None');
- }
- }
- }
- // for posts
- add_filter( 'manage_posts_columns', 'fb_AddThumbColumn' );
- add_action( 'manage_posts_custom_column', 'fb_AddThumbValue', 10, 2 );
- // for pages
- add_filter( 'manage_pages_columns', 'fb_AddThumbColumn' );
- add_action( 'manage_pages_custom_column', 'fb_AddThumbValue', 10, 2 );
- }
- /* Remove Thematic_Above_Navigation */
- function remove_nav(){
- remove_action('thematic_navigation_above', 'thematic_nav_above', 2);
- }
- add_action('init', 'remove_nav');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement