Help with query_posts function
Question
I have a paid theme that has the following function manually hard-coded. It pulls the 8 latest posts and displays them:
<?php global $do_not_duplicate; global $post; $count = 0; query_posts(array( 'posts_per_page' => '8', 'post__not_in'=>$do_not_duplicate, 'ignore_sticky_posts'=> 1 )); if (have_posts()) : while (have_posts()) : the_post(); $count++; ?>
I have looked at this page and tried to modify the code to show posts from the new category only (category number 1):
<?php global $do_not_duplicate; global $post; $count = 0; query_posts(array( 'cat=1', 'posts_per_page' => '8', 'post__not_in'=>$do_not_duplicate, 'ignore_sticky_posts'=> 1 )); if (have_posts()) : while (have_posts()) : the_post(); $count++; ?>
<?php global $do_not_duplicate; global $post; $count = 0; query_posts(array( 'category=1', 'posts_per_page' => '8', 'post__not_in'=>$do_not_duplicate, 'ignore_sticky_posts'=> 1 )); if (have_posts()) : while (have_posts()) : the_post(); $count++; ?>
<?php global $do_not_duplicate; global $post; $count = 0; query_posts(array( 'category' => array(1), 'posts_per_page' => '8', 'post__not_in'=>$do_not_duplicate, 'ignore_sticky_posts'=> 1 )); if (have_posts()) : while (have_posts()) : the_post(); $count++; ?>
<?php global $do_not_duplicate; global $post; $count = 0; query_posts(array( 'cat=news', 'posts_per_page' => '8', 'post__not_in'=>$do_not_duplicate, 'ignore_sticky_posts'=> 1 )); if (have_posts()) : while (have_posts()) : the_post(); $count++; ?>
Nothing worked. The same list of 8 recent posts from all categories was returned.
0
2 months
0 Answers
14 views
0
Leave an answer
You must login or register to add a new answer .