• Hello,
    so I have this php code I took from blog page of the template and it shows list of news under the portfolio part of the page. Website is on this link Dubrovnik2020.
    So what I need is that under the portfolio part of home page ONLY 3 LATEST POSTS show but with this code I get all the posts and they keep loading again and again as I scroll down.. Please tell me what to change in this part of code that gets posts ??

    <br />
    <?php while ( have_posts() ) : the_post();</p>
    <p>		$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : ( get_query_var( 'page' ) ? get_query_var( 'page' ) : 1 );</p>
    <p>		$args = array(<br />
    			'paged' => $paged,<br />
    			'post_type' => 'post'<br />
    		);<br />
    		$all_posts = new WP_Query( $args );</p>
    <p>		?></p>
    <p>		<div id="posts-container" class="clearfix"></p>
    <p>			<?php while ( $all_posts->have_posts() ) : $all_posts->the_post();</p>
    <p>				get_template_part( 'content' );</p>
    <p>			endwhile; ?></p>
    <p>		</div></p>
    <p>	<?php endwhile;</p>
    <p>get_footer(); ?><br />

    [bump moderated]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘What to change here to get only 3 latest posts? Please help’ is closed to new replies.