catchresponsive_featured_image

Template for Featured Header Image from theme options.

Description

catchresponsive_featured_image(); 

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


Usage

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

Defined (1)

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

/inc/catchresponsive-custom-header.php  
  1. function catchresponsive_featured_image() { 
  2.  
  3. $header_image = get_header_image(); 
  4.  
  5. //Support Random Header Image 
  6. if ( is_random_header_image() ) { 
  7. delete_transient( 'catchresponsive_featured_image' ); 
  8.  
  9. if ( !$catchresponsive_featured_image = get_transient( 'catchresponsive_featured_image' ) ) { 
  10.  
  11. echo '<!-- refreshing cache -->'; 
  12.  
  13. if ( '' != $header_image ) { 
  14.  
  15. // Header Image Link and Target 
  16. if ( !empty( $options[ 'featured_header_image_url' ] ) ) { 
  17. //support for qtranslate custom link 
  18. if ( function_exists( 'qtrans_convertURL' ) ) { 
  19. $link = qtrans_convertURL($options[ 'featured_header_image_url' ]); 
  20. else { 
  21. $link = esc_url( $options[ 'featured_header_image_url' ] ); 
  22. //Checking Link Target 
  23. if ( !empty( $options[ 'featured_header_image_base' ] ) ) { 
  24. $target = '_blank'; 
  25. else { 
  26. $target = '_self'; 
  27. else { 
  28. $link = ''; 
  29. $target = ''; 
  30.  
  31. // Header Image Title/Alt 
  32. if ( !empty( $options[ 'featured_header_image_alt' ] ) ) { 
  33. $title = esc_attr( $options[ 'featured_header_image_alt' ] ); 
  34. else { 
  35. $title = ''; 
  36.  
  37. // Header Image 
  38. $feat_image = '<img class="wp-post-image" alt="'.$title.'" src="'.esc_url( $header_image ).'" />'; 
  39.  
  40. $catchresponsive_featured_image = '<div id="header-featured-image"> 
  41. <div class="wrapper">'; 
  42. // Header Image Link 
  43. if ( !empty( $options[ 'featured_header_image_url' ] ) ) : 
  44. $catchresponsive_featured_image .= '<a title="'. esc_attr( $title ).'" href="'. esc_url( $link ) .'" target="'.$target.'">' . $feat_image . '</a>'; 
  45. else: 
  46. // if empty featured_header_image on theme options, display default 
  47. $catchresponsive_featured_image .= $feat_image; 
  48. endif; 
  49. $catchresponsive_featured_image .= '</div><!-- .wrapper --> 
  50. </div><!-- #header-featured-image -->'; 
  51.  
  52. set_transient( 'catchresponsive_featured_image', $catchresponsive_featured_image, 86940 ); 
  53.  
  54. echo $catchresponsive_featured_image; 
  55.  
  56. } // catchresponsive_featured_image