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.

I have the page count set to the default 10 in my reading settings menu.

screenshot-with-shadow.jpg

However, I use my template archive.php file for all post types, including posts and books

How can I change the loop so that when searching books it will show 30 books in the archive page instead of showing the default 10?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I think something like this should work:

add_action('parse_query', 'wpse32932_parse_query'); 
function wpse32932_parse_query( $wp ){
    if( $wp->is_post_type_archive ):
        $wp->query_vars['posts_per_page'] = 30;
    endif;
    return $wp;
}
share|improve this answer
    
excellent solution. thanks! –  cwd Nov 8 '11 at 1:26

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.