Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Trying to query pages based on the category they are associated with. I am passing in the cat_ID, but it doesn't seem to be working. Always returns a single post with the title "Hello World" while there is an actual page with real title associated with this category.

// The Query
query_posts('cat='.$current);

// The Loop
while ( have_posts() ) : the_post();

    the_title();

endwhile;

// Reset Query
wp_reset_query();
share|improve this question

1 Answer 1

up vote 0 down vote accepted

It's because the default query is only querying for post_type post, you have to explicitly add page to get it to also query for pages:

$args = array(
    'cat' => $current,
    'post_type' => array( 'page', 'post' )
);
query_posts( $args );
share|improve this answer
    
Ahh ha! Thanks, –  Louis W Oct 2 '11 at 17:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.