gosuprojects Posted July 2, 2009 Share Posted July 2, 2009 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 --> Quote Link to comment https://forums.phpfreaks.com/topic/164463-limit-posts-wordpress/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.