catchresponsive_featured_page_post_image

Template for Featured Header Image from Post and Page.

Description

catchresponsive_featured_page_post_image(); 

To override this in a child theme simply create your own catchresponsive_featured_imaage_pagepost(), and that function will be used instead.


Usage

  1. if ( !function_exists( 'catchresponsive_featured_page_post_image' ) ) { 
  2. require_once '/inc/catchresponsive-custom-header.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = catchresponsive_featured_page_post_image(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/catchresponsive-custom-header.php  
  1. function catchresponsive_featured_page_post_image() { 
  2. global $post, $wp_query; 
  3.  
  4. // Get Page ID outside Loop 
  5. $page_id = $wp_query->get_queried_object_id(); 
  6. $page_for_posts = get_option('page_for_posts'); 
  7.  
  8. if ( is_home() && $page_for_posts == $page_id ) { 
  9. $header_page_id = $page_id; 
  10. else { 
  11. $header_page_id = $post->ID; 
  12.  
  13. if ( has_post_thumbnail( $header_page_id ) ) { 
  14. $featured_header_image_url = $options['featured_header_image_url']; 
  15. $featured_header_image_base = $options['featured_header_image_base']; 
  16.  
  17. if ( '' != $featured_header_image_url ) { 
  18. //support for qtranslate custom link 
  19. if ( function_exists( 'qtrans_convertURL' ) ) { 
  20. $link = qtrans_convertURL( $featured_header_image_url ); 
  21. else { 
  22. $link = esc_url( $featured_header_image_url ); 
  23. //Checking Link Target 
  24. if ( '1' == $featured_header_image_base ) { 
  25. $target = '_blank'; 
  26. else { 
  27. $target = '_self'; 
  28. else { 
  29. $link = ''; 
  30. $target = ''; 
  31.  
  32. $featured_header_image_alt = $options['featured_header_image_alt']; 
  33. // Header Image Title/Alt 
  34. if ( '' != $featured_header_image_alt ) { 
  35. $title = esc_attr( $featured_header_image_alt ); 
  36. else { 
  37. $title = ''; 
  38.  
  39. $featured_image_size = $options['featured_image_size']; 
  40.  
  41. if ( 'slider' == $featured_image_size ) { 
  42. $feat_image = get_the_post_thumbnail( $post->ID, 'catchresponsive-slider', array('id' => 'main-feat-img')); 
  43. elseif ( 'full' == $featured_image_size ) { 
  44. $feat_image = get_the_post_thumbnail( $post->ID, 'full', array('id' => 'main-feat-img')); 
  45. else { 
  46. $feat_image = get_the_post_thumbnail( $post->ID, 'catchresponsive-large', array('id' => 'main-feat-img')); 
  47.  
  48. $catchresponsive_featured_image = '<div id="header-featured-image" class =' . $featured_image_size . '>'; 
  49. // Header Image Link 
  50. if ( '' != $featured_header_image_url ) : 
  51. $catchresponsive_featured_image .= '<a title="'. esc_attr( $title ).'" href="'. esc_url( $link ) .'" target="'.$target.'">' . $feat_image . '</a>'; 
  52. else: 
  53. // if empty featured_header_image on theme options, display default 
  54. $catchresponsive_featured_image .= $feat_image; 
  55. endif; 
  56. $catchresponsive_featured_image .= '</div><!-- #header-featured-image -->'; 
  57.  
  58. echo $catchresponsive_featured_image; 
  59. else { 
  60. } // catchresponsive_featured_page_post_image