catchresponsive_page_content

This function to display featured page content.

Description

catchresponsive_page_content( $options ); 

Parameters (1)

0. $options
Catchresponsive_theme_options from customizer

Usage

  1. if ( !function_exists( 'catchresponsive_page_content' ) ) { 
  2. require_once '/inc/catchresponsive-featured-content.php'; 
  3.  
  4. // catchresponsive_theme_options from customizer 
  5. $options = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = catchresponsive_page_content($options); 
  9.  

Defined (1)

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

/inc/catchresponsive-featured-content.php  
  1. function catchresponsive_page_content( $options ) { 
  2. global $post; 
  3.  
  4. $quantity = $options [ 'featured_content_number' ]; 
  5.  
  6. $more_link_text = $options['excerpt_more_text']; 
  7.  
  8. $show_content = $options['featured_content_show']; 
  9.  
  10. $catchresponsive_page_content = ''; 
  11.  
  12. $number_of_page = 0; // for number of pages 
  13.  
  14. $page_list = array(); // list of valid pages ids 
  15.  
  16. //Get valid pages 
  17. for( $i = 1; $i <= $quantity; $i++ ) { 
  18. if ( isset ( $options['featured_content_page_' . $i] ) && $options['featured_content_page_' . $i] > 0 ) { 
  19. $number_of_page++; 
  20.  
  21. $page_list = array_merge( $page_list, array( $options['featured_content_page_' . $i] ) ); 
  22.  
  23. if ( !empty( $page_list ) && $number_of_page > 0 ) { 
  24. $get_featured_posts = new WP_Query( array( 
  25. 'posts_per_page' => $number_of_page,  
  26. 'post__in' => $page_list,  
  27. 'orderby' => 'post__in',  
  28. 'post_type' => 'page',  
  29. )); 
  30.  
  31. $i=0; 
  32. while ( $get_featured_posts->have_posts()) : $get_featured_posts->the_post(); $i++; 
  33. $title_attribute = the_title_attribute( array( 'before' => __( 'Permalink to: ', 'catch-responsive' ), 'echo' => false ) ); 
  34.  
  35. $excerpt = get_the_excerpt(); 
  36.  
  37. $catchresponsive_page_content .= ' 
  38. <article id="featured-post-' . $i . '" class="post hentry featured-page-content">'; 
  39. if ( has_post_thumbnail() ) { 
  40. $catchresponsive_page_content .= ' 
  41. <figure class="featured-homepage-image"> 
  42. <a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'"> 
  43. '. get_the_post_thumbnail( $post->ID, 'catchresponsive-featured-content', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'pngfix' ) ) .' 
  44. </a> 
  45. </figure>'; 
  46. else { 
  47. $catchresponsive_first_image = catchresponsive_get_first_image( $post->ID, 'catchresponsive-featured-content', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'pngfix' ) ); 
  48.  
  49. if ( '' != $catchresponsive_first_image ) { 
  50. $catchresponsive_page_content .= ' 
  51. <figure class="featured-homepage-image"> 
  52. <a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'"> 
  53. '. $catchresponsive_first_image .' 
  54. </a> 
  55. </figure>'; 
  56.  
  57. $catchresponsive_page_content .= ' 
  58. <div class="entry-container"> 
  59. <header class="entry-header"> 
  60. <h1 class="entry-title"> 
  61. <a href="' . get_permalink() . '" rel="bookmark">' . the_title( '', '', false ) . '</a> 
  62. </h1> 
  63. </header>'; 
  64. if ( 'excerpt' == $show_content ) { 
  65. $catchresponsive_page_content .= '<div class="entry-excerpt"><p>' . $excerpt . '</p></div><!-- .entry-excerpt -->'; 
  66. elseif ( 'full-content' == $show_content ) { 
  67. $content = apply_filters( 'the_content', get_the_content() ); 
  68. $content = str_replace( ']]>', ']]>', $content ); 
  69. $catchresponsive_page_content .= '<div class="entry-content">' . $content . '</div><!-- .entry-content -->'; 
  70. $catchresponsive_page_content .= ' 
  71. </div><!-- .entry-container --> 
  72. </article><!-- .featured-post-'. $i .' -->'; 
  73. endwhile; 
  74.  
  75. wp_reset_query(); 
  76.  
  77. return $catchresponsive_page_content;