Advertisement
catchmahesh

Remove load more in Featured Grid Content Fabulous Fluid

Aug 3rd, 2016
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.91 KB | None | 0 0
  1. function fabulous_fluid_grid_page_content( ) {
  2.     global $post;
  3.  
  4.     $quantity   = apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_number' );
  5.  
  6.     $output = '';
  7.  
  8.     $number_of_page             = 0;        // for number of pages
  9.  
  10.     $page_list                  = array();  // list of valid pages ids
  11.  
  12.     //Get valid pages
  13.     for( $i = 1; $i <= $quantity; $i++ ){
  14.         if( apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_page_' . $i ) && apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_page_' . $i ) > 0 ) {
  15.             $number_of_page++;
  16.  
  17.             $page_list  =   array_merge( $page_list, array( apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_page_' . $i ) ) );
  18.         }
  19.  
  20.     }
  21.     if ( !empty( $page_list ) && $number_of_page > 0 ) {
  22.         $get_featured_posts = new WP_Query( array(
  23.                     'posts_per_page'        => $number_of_page,
  24.                     'post__in'              => $page_list,
  25.                     'orderby'               => 'post__in',
  26.                     'post_type'             => 'page',
  27.                 ));
  28.  
  29.         $show_content    = apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_show' );
  30.  
  31.         $i = 1;
  32.  
  33.         $j = 1;
  34.         $output .= '<div class="row odd">';
  35.  
  36.         while ( $get_featured_posts->have_posts()) {
  37.             $get_featured_posts->the_post();
  38.  
  39.             $title_attribute = the_title_attribute( array( 'echo' => false ) );
  40.  
  41.             $class      = 'col col-small';
  42.             $image_size = 'post-thumbnail';
  43.  
  44.             if ( 1 == $i%3 ) {
  45.                 $class      = 'col col-large';
  46.                 $image_size = 'fabulous-fluid-grid-large';
  47.             }
  48.  
  49.             $output .= '
  50.                 <div class="' . $class . '">';
  51.  
  52.                 $output .= '
  53.                     <div id="featured-page-' . $i . '" class="post">';
  54.  
  55.                 $output .= '
  56.                     <div class="text-holder">
  57.                         <header class="entry-header">
  58.                             <h2 class="entry-title">
  59.                                 <a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . the_title( '','', false ) . '</a>
  60.                             </h2>
  61.                             <div class="meta-info">
  62.                                 ' .  fabulous_fluid_grid_content_meta() . '
  63.                             </div>
  64.                         </header><!-- .entry-header -->';
  65.  
  66.                         if ( 'excerpt' == $show_content ) {
  67.                             $excerpt = get_the_excerpt();
  68.  
  69.                             $output .= '<div class="entry-content excerpt"><p>' . $excerpt . '</p></div><!-- .entry-content.excerpt -->';
  70.                         }
  71.                         elseif ( 'full-content' == $show_content ) {
  72.                             $content = apply_filters( 'the_content', get_the_content() );
  73.                             $content = str_replace( ']]>', ']]&gt;', $content );
  74.                             $output .= '<div class="entry-content">' . $content . '</div><!-- .entry-content -->';
  75.                         }
  76.                         $output .= '
  77.                     </div><!-- .text-holder -->
  78.  
  79.                     <div class="img-holder">
  80.                         <a href="' . esc_url( get_permalink() ) . '">';
  81.                         if ( has_post_thumbnail() ) {
  82.                             $output .= get_the_post_thumbnail( $post->ID, $image_size, array( 'title' => $title_attribute, 'alt' => $title_attribute ) );
  83.                         }
  84.                         else {
  85.                             //Default no image
  86.                             $image = '<img class="no-image" src="'.get_template_directory_uri().'/images/no-featured-image-420x283.jpg" >';
  87.  
  88.                             if ( 'fabulous-fluid-grid-large' == $image_size ) {
  89.                                 $image = '<img class="no-image" src="'.get_template_directory_uri().'/images/no-featured-image-840x565.jpg" >';
  90.                             }
  91.  
  92.                             // First Image from content
  93.                             $first_image = fabulous_fluid_get_first_image( $post->ID, $image_size, array( 'title' => $title_attribute, 'alt' => $title_attribute ) );
  94.  
  95.                             if ( '' != $first_image ) {
  96.                                 $image = $first_image;
  97.                             }
  98.  
  99.                             $output .= $image;
  100.                         }
  101.  
  102.                         $output .= '
  103.                         </a>
  104.                     </div><!-- .img-holder -->
  105.                 </div><!-- #featured-post-'. $i .'.post -->';
  106.  
  107.                 $output .= '
  108.                 </div><!-- .col-large.col-small -->';
  109.  
  110.             if ( 0 == $i%3 ) {
  111.                 $j++;
  112.  
  113.                 $class = ( 0 == $j%2 ) ? 'even' : 'odd';
  114.                 $output .= '
  115.             </div><!-- .row -->
  116.  
  117.             <div class="row ' . $class .'">';
  118.             }
  119.  
  120.             $i++;
  121.         }
  122.  
  123.         $output .= '</div><!-- .row -->';
  124.  
  125.         wp_reset_query();
  126.     }
  127.  
  128.     return $output;
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement