Advertisement
srikat

functions.php

Aug 23rd, 2014
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. //* Display Featured image after header on Pages and single Posts
  2. //* only on the first page if the Page or Post is divided into multiple using <!--nextpage-->
  3.  
  4. add_action ( 'genesis_after_header', 'sk_featured_image', 9 );
  5. function sk_featured_image() {
  6.  
  7.     // global $wp_query;
  8.     // $paged = $wp_query->get( 'paged' );
  9.  
  10.     $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : false;
  11.  
  12.     // echo 'The value of $paged is: ' . $paged;
  13.  
  14.     if ( has_post_thumbnail() && ( is_page() || is_single() ) && $paged === false ) {
  15.         $image = genesis_get_image( 'format=url' );
  16.         printf( '<div class="my-featured-image"><img src="%s" alt="%s" class="aligncenter" /></div>', $image, the_title_attribute( 'echo=0' ) );
  17.  
  18.     }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement