Advertisement
Guest User

WP 2011 if is_page_template

a guest
Nov 11th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.04 KB | None | 0 0
  1. <?php
  2.  
  3.   if ( is_page_template('page-full-no-feature.php') ) {
  4.     // Returns true when 'page-full-no-feature.php' is being used.
  5. } else {
  6.  
  7.  
  8.  
  9. // Check to see if the header image has been removed
  10.                 $header_image = get_header_image();
  11. if ( $header_image ) :
  12.                     // Compatibility with versions of WordPress prior to 3.4.
  13.                     if ( function_exists( 'get_custom_header' ) ) {
  14.                         // We need to figure out what the minimum width should be for our featured image.
  15.                         // This result would be the suggested width if the theme were to implement flexible widths.
  16.                         $header_image_width = get_theme_support( 'custom-header', 'width' );
  17.                     } else {
  18.                         $header_image_width = HEADER_IMAGE_WIDTH;
  19.                     }
  20.                     ?>
  21.             <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
  22.                 <?php
  23.                     // The header image
  24.                     // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  25.                     if ( is_singular() && has_post_thumbnail( $post->ID ) &&
  26.                             ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
  27.                             $image[1] >= $header_image_width ) :
  28.                         // Houston, we have a new header image!
  29.                         echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
  30.                     else :
  31.                         // Compatibility with versions of WordPress prior to 3.4.
  32.                         if ( function_exists( 'get_custom_header' ) ) {
  33.                             $header_image_width  = get_custom_header()->width;
  34.                             $header_image_height = get_custom_header()->height;
  35.                         } else {
  36.                             $header_image_width  = HEADER_IMAGE_WIDTH;
  37.                             $header_image_height = HEADER_IMAGE_HEIGHT;
  38.                         }
  39.                         ?>
  40.                     <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
  41.                 <?php endif; // end check for featured image or standard header ?>
  42.             </a>
  43.             <?php endif; } // end check for removed header image ?>
  44.             <?php
  45.                 // Has the text been hidden?
  46.                 if ( 'blank' == get_header_textcolor() ) :
  47.             ?>
  48.  
  49.             <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement