Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fabulous_fluid_grid_page_content( ) {
- global $post;
- $quantity = apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_number' );
- $output = '';
- $number_of_page = 0; // for number of pages
- $page_list = array(); // list of valid pages ids
- //Get valid pages
- for( $i = 1; $i <= $quantity; $i++ ){
- if( apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_page_' . $i ) && apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_page_' . $i ) > 0 ) {
- $number_of_page++;
- $page_list = array_merge( $page_list, array( apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_page_' . $i ) ) );
- }
- }
- if ( !empty( $page_list ) && $number_of_page > 0 ) {
- $get_featured_posts = new WP_Query( array(
- 'posts_per_page' => $number_of_page,
- 'post__in' => $page_list,
- 'orderby' => 'post__in',
- 'post_type' => 'page',
- ));
- $show_content = apply_filters( 'fabulous_fluid_get_option', 'featured_grid_content_show' );
- $i = 1;
- $j = 1;
- $output .= '<div class="row odd">';
- while ( $get_featured_posts->have_posts()) {
- $get_featured_posts->the_post();
- $title_attribute = the_title_attribute( array( 'echo' => false ) );
- $class = 'col col-small';
- $image_size = 'post-thumbnail';
- if ( 1 == $i%3 ) {
- $class = 'col col-large';
- $image_size = 'fabulous-fluid-grid-large';
- }
- $output .= '
- <div class="' . $class . '">';
- $output .= '
- <div id="featured-page-' . $i . '" class="post">';
- $output .= '
- <div class="text-holder">
- <header class="entry-header">
- <h2 class="entry-title">
- <a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . the_title( '','', false ) . '</a>
- </h2>
- <div class="meta-info">
- ' . fabulous_fluid_grid_content_meta() . '
- </div>
- </header><!-- .entry-header -->';
- if ( 'excerpt' == $show_content ) {
- $excerpt = get_the_excerpt();
- $output .= '<div class="entry-content excerpt"><p>' . $excerpt . '</p></div><!-- .entry-content.excerpt -->';
- }
- elseif ( 'full-content' == $show_content ) {
- $content = apply_filters( 'the_content', get_the_content() );
- $content = str_replace( ']]>', ']]>', $content );
- $output .= '<div class="entry-content">' . $content . '</div><!-- .entry-content -->';
- }
- $output .= '
- </div><!-- .text-holder -->
- <div class="img-holder">
- <a href="' . esc_url( get_permalink() ) . '">';
- if ( has_post_thumbnail() ) {
- $output .= get_the_post_thumbnail( $post->ID, $image_size, array( 'title' => $title_attribute, 'alt' => $title_attribute ) );
- }
- else {
- //Default no image
- $image = '<img class="no-image" src="'.get_template_directory_uri().'/images/no-featured-image-420x283.jpg" >';
- if ( 'fabulous-fluid-grid-large' == $image_size ) {
- $image = '<img class="no-image" src="'.get_template_directory_uri().'/images/no-featured-image-840x565.jpg" >';
- }
- // First Image from content
- $first_image = fabulous_fluid_get_first_image( $post->ID, $image_size, array( 'title' => $title_attribute, 'alt' => $title_attribute ) );
- if ( '' != $first_image ) {
- $image = $first_image;
- }
- $output .= $image;
- }
- $output .= '
- </a>
- </div><!-- .img-holder -->
- </div><!-- #featured-post-'. $i .'.post -->';
- $output .= '
- </div><!-- .col-large.col-small -->';
- if ( 0 == $i%3 ) {
- $j++;
- $class = ( 0 == $j%2 ) ? 'even' : 'odd';
- $output .= '
- </div><!-- .row -->
- <div class="row ' . $class .'">';
- }
- $i++;
- }
- $output .= '</div><!-- .row -->';
- wp_reset_query();
- }
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement