• Resolved llawliet2

    (@llawliet2)


    Hi.
    I have two questions about the PlugIn “Display Posts Grid, List Without Coding – Content Views”.

    Q1) When my site has the “static page” as the front page, the Grid shows, but when its front page is “latest posts”, the grid doesn’t work.
    As I searched the forum, I have tried two ways to put the code in the theme’s index page.

    <?php get_header(); ?>

    <section class=”content”>
    <?php if ( ! hu_is_home_empty() ) : ?>
    <?php hu_get_template_part(‘parts/page-title’); ?>

    <div class=”pad group”>

    <?php if ( hu_is_checked(‘featured-posts-enabled’) ) { get_template_part(‘parts/featured’); } ?>

    <?php if ( have_posts() ) : ?>

    <?php if ( hu_is_checked(‘blog-standard’) ): ?>
    <?php while ( have_posts() ): the_post(); ?>
    <?php get_template_part(‘content-standard’); ?>
    <?php endwhile; ?>
    <?php else: ?>
    <div id=”grid-wrapper” class=”post-list group”>
    <?php $i = 1; echo ‘<div class=”post-row”>’; while ( have_posts() ): the_post(); ?>
    <?php get_template_part(‘content’); ?>
    <?php if($i % 2 == 0) { echo ‘</div><div class=”post-row”>’; } $i++; endwhile; echo ‘</div>’; ?>
    </div><!–/.post-list–>
    <?php endif; ?>

    <?php get_template_part(‘parts/pagination’); ?>

    <?php endif; ?>

    </div><!–/.pad–>
    <?php endif; ?>
    </section><!–/.content–>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    <?php
    /* CV: show custom grid on homepage */
    if ( is_front_page() && !is_home() ) {
    echo do_shortcode( “[pt_view id=ID: xxxxx]” );
    }
    ?>

    This didn’t work, so I tried the other way now

    <?php get_header(); ?>

    <section class=”content”>
    <?php if ( ! hu_is_home_empty() ) : ?>
    <?php hu_get_template_part(‘parts/page-title’); ?>

    <div class=”pad group”>

    <?php if ( hu_is_checked(‘featured-posts-enabled’) ) { get_template_part(‘parts/featured’); } ?>

    <?php if ( have_posts() ) : ?>

    <?php if ( hu_is_checked(‘blog-standard’) ): ?>
    <?php while ( have_posts() ): the_post(); ?>
    <?php get_template_part(‘content-standard’); ?>
    <?php endwhile; ?>
    <?php else: ?>
    <div id=”grid-wrapper” class=”post-list group”>
    <?php $i = 1; echo ‘<div class=”post-row”>’; if ( !is_front_page() && is_home() ) :
    echo do_shortcode(“[pt_view id=xxxxx]”);
    else : while ( have_posts() ): the_post(); ?>
    <?php get_template_part(‘content’); ?>
    <?php if($i % 2 == 0) { echo ‘</div><div class=”post-row”>’; } $i++; endwhile; endif; echo ‘</div>’; ?>
    </div><!–/.post-list–>
    <?php endif; ?>

    <?php get_template_part(‘parts/pagination’); ?>

    <?php endif; ?>

    </div><!–/.pad–>
    <?php endif; ?>
    </section><!–/.content–>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    I still cannot make the grid work when I have the front page as “latest post”.
    The grid you can see in my website is from the theme, not the plugin.
    Will you please help me?

    Q2) I thought we could put the recent(latest) post in each category to make up the grid in each row, but it seems as though they are from all the category by the date.
    How can I have each row from each different category? That is what I wanted, so I downloaded this plugin.

    Thank you so much.

Viewing 1 replies (of 1 total)
  • Plugin Author Content Views

    (@pt-guy)

    Hello,
    1/ Blog page
    I think the reason it didn’t work because you put the code in wrong place. In your index.php file, this code hu_is_checked( 'blog-standard' ) maybe already checked for blog page.

    Please try this code

    
    <?php get_header(); ?>
    
    <section class="content">
    	<?php if ( !hu_is_home_empty() ) : ?>
    		<?php hu_get_template_part( 'parts/page-title' ); ?>
    
    		<div class="pad group">
    
    			<?php
    			if ( hu_is_checked( 'featured-posts-enabled' ) ) {
    				get_template_part( 'parts/featured' );
    			}
    			?>
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php if ( hu_is_checked( 'blog-standard' ) ): ?>
    					<?php echo do_shortcode( "[pt_view id=VIEWID]" ); ?>
    					<?php #while ( have_posts() ): the_post(); ?>
    					<?php #get_template_part( 'content-standard' ); ?>
    					<?php #endwhile; ?>
    				<?php else: ?>
    					<div id="grid-wrapper" class="post-list group">
    						<?php
    						$i = 1;
    						echo '<div class = "post-row">';
    						while ( have_posts() ): the_post();
    							?>
    							<?php get_template_part( 'content' ); ?>
    							<?php
    							if ( $i % 2 == 0 ) {
    								echo '</div><div class = "post-row">';
    							} $i++;
    						endwhile;
    						echo '</div>';
    						?>
    					</div><!–/.post-list–>
    				<?php endif; ?>
    
    				<?php get_template_part( 'parts/pagination' ); ?>
    
    			<?php endif; ?>
    
    		</div><!–/.pad–>
    	<?php endif; ?>
    </section><!–/.content–>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    

    (Please replace VIEWID with real ID key of your View)

    2/ Each row from each different category
    In free version, you can achieve it by create different Views for different categories.
    For example:
    View 1: Limit = 3, select category 1
    View 2: Limit = 3, select category 2

    then paste 2 Views shortcode together:

    
    [pt_view id="VIEW_1"]
    [pt_view id="VIEW_2"]
    

    In Pro version, there is option to show N posts of each selected categories.

    Best regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Latest Posts vs. Static Page – Display Posts Grid, Without Coding Content Views’ is closed to new replies.