Limit query Page
-
i try to query all of my work and random it But i want to show only 4
- but it show all work on my page
<?php$categoriesCF = get_post_meta($post->ID, "categories", true);
// example value = "Sprockets|92,Sprunklers|94"$allCategories = explode(",", $categoriesCF);
// $allCategories[0] = "Sprockets|92"
// $allCategories[1] = "Sprunklers|94"foreach ($allCategories as $category) {
$pieces = explode("|", $category);
// $pieces[0] = "Sprockets"
// $pieces[1] = 92$link = get_permalink($pieces[1]);
echo "- ";
shuffle(query_posts("posts_per_page=4&post_type=page&orderby=rand&post_parent=$pieces[1]"));
while (have_posts()) : the_post(); ?>
<li class="workunit">
">
<?php echo "<img src='" . get_post_meta($post->ID, "thumb_image", true) . "' />"; ?>
<h2><?php the_title(); ?></h2><?php endwhile; wp_reset_query();
echo “”;
};
?>
Thank for help in advance i’m a designer that know a few of programing THANK A LOT - but it show all work on my page
-
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
- The topic ‘Limit query Page’ is closed to new replies.