Advertisement
helgatheviki

scottyeskel functions.php

Sep 19th, 2011
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.30 KB | None | 0 0
  1. <?php
  2.  
  3. /* These are functions specific to this theme */
  4.  
  5.  
  6. /*
  7.  *  Scripts and Header
  8.  */
  9. function clean_header(){
  10.  
  11.     // CLEAN UP HEADER
  12.     remove_action( 'wp_head', 'wlwmanifest_link'); // Remvoes link for Windows Live Writer users
  13.     remove_action( 'wp_head', 'wp_generator'); // Removes WP version
  14.     remove_action( 'wp_head', 'rsd_link' ); // Removes unneeded Really Simple Discovery link
  15.     remove_action( 'wp_head', 'start_post_rel_link'); //Remove relational start link
  16.     remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head'); // Remove prev/next relational links
  17.  
  18. }
  19. add_action('init','clean_header');
  20.  
  21. // Add the Contact Form 7 scripts only on the contact page
  22. function deregister_cf7_js() {
  23.     if ( !is_page('contact')) {
  24.         wp_deregister_script( 'contact-form-7');
  25.     }
  26. }
  27. add_action( 'wp_print_scripts', 'deregister_cf7_js' );
  28.  
  29. function deregister_ct7_styles() {
  30.     wp_deregister_style( 'contact-form-7');
  31. }
  32. add_action( 'wp_print_styles', 'deregister_ct7_styles');
  33.  
  34.  
  35.  
  36. //remove bundled wp-pagenavi css
  37. function my_deregister_styles() {
  38.     wp_deregister_style( 'wp-pagenavi' );
  39. }
  40. add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
  41.  
  42.  
  43.  
  44. /* MU Specific Function to Determine Actual Image Path */
  45. if(!function_exists('get_mu_image_path')){
  46.  
  47.     function get_mu_image_path($img_src) {
  48.         global $blog_id;
  49.         if (isset($blog_id) && $blog_id > 0) {
  50.             $imageParts = explode('/files/', $img_src);
  51.             if (isset($imageParts[1])) {
  52.                 $img_src = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
  53.             }
  54.         }
  55.         return $img_src;
  56.     }
  57. }
  58.  
  59.  
  60.  
  61.  
  62.  
  63. /*
  64. * ADD THUMBNAIL IN POST/PAGE OVERVIEW
  65. */
  66.  
  67. if ( !function_exists('fb_AddThumbColumn') && function_exists('add_theme_support') ) {
  68.     // for post and page
  69.     add_theme_support('post-thumbnails', array( 'post', 'page' ) );
  70.     function fb_AddThumbColumn($cols) {
  71.         //$cols['thumbnail'] = __('Thumbnail');
  72.        
  73.         $part1=array_slice($cols,0,2);
  74.         $part2=array_slice($cols,2);
  75.         $part1['thumbnail']=__('Thumbnail');
  76.         $cols=array_merge($part1,$part2);
  77.  
  78.  
  79.         return $cols;
  80.     }
  81.     function fb_AddThumbValue($column_name, $post_id) {
  82.             $width = (int) 35;
  83.             $height = (int) 35;
  84.             if ( 'thumbnail' == $column_name ) {
  85.                 // thumbnail of WP 2.9
  86.                 $thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
  87.                 // image from gallery
  88.                 $attachments = get_children( array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image') );
  89.                 if ($thumbnail_id)
  90.                     $thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true );
  91.                 elseif ($attachments) {
  92.                     foreach ( $attachments as $attachment_id => $attachment ) {
  93.                         $thumb = wp_get_attachment_image( $attachment_id, array($width, $height), true );
  94.                     }
  95.                 }
  96.                     if ( isset($thumb) && $thumb ) {
  97.                         echo $thumb;
  98.                     } else {
  99.                         echo __('None');
  100.                     }
  101.             }
  102.     }
  103.     // for posts
  104.     add_filter( 'manage_posts_columns', 'fb_AddThumbColumn' );
  105.     add_action( 'manage_posts_custom_column', 'fb_AddThumbValue', 10, 2 );
  106.     // for pages
  107.     add_filter( 'manage_pages_columns', 'fb_AddThumbColumn' );
  108.     add_action( 'manage_pages_custom_column', 'fb_AddThumbValue', 10, 2 );
  109. }
  110.  
  111. /* Remove Thematic_Above_Navigation */
  112. function remove_nav(){
  113.     remove_action('thematic_navigation_above', 'thematic_nav_above', 2);
  114. }
  115. add_action('init', 'remove_nav');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement