Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.