Jump to content

Limit posts (wordpress)


Recommended Posts

Hi all, I am trying to limit the amount if posts (wordpress install) in the panel with black arrows... you can see what I mean here:

 

http://www.jasonstrachan.net/

 

Currently it displays all posts. I was hoping I could add some php to limit the amount of posts it displays to the three latest posts. Here is ther code:

 

<!-- element with overflow applied -->

<div class="scroll">

<!-- the element that will be scrolled during the effect -->

<div class="scrollContainer">

 

<?php

$the_query = new WP_Query('category_name=featured');

while ($the_query->have_posts()) : $the_query->the_post();

$do_not_duplicate = $post->ID;

// We show just 1 post of category panel order by post date descendent and don't be show after | http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action

?>

               

else { ?>               

<div class="panel">

<?php portfolio_panel() ?>

</div>

 

<?php endwhile; ?> <!-- End panel -->

 

 

 

<?php

query_posts('category_name=work');

// http://codex.wordpress.org/Template_Tags/query_posts | We show posts from category Work

?>

       

 

 

<?php

if (have_posts()) : while (have_posts()) : the_post();

if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts);

// http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action

?>

<div class="panel" >

<?php portfolio_panel() ?>

</div>

 

<?php endwhile; endif; ?>

 

</div><!-- .scrollContainer -->

</div><!-- .scroll -->

Link to comment
https://forums.phpfreaks.com/topic/164463-limit-posts-wordpress/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.