0

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

screenshot-with-shadow.jpg http://img257.imageshack.us/img257/5788/screenshotwithshadow.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?

1

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;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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