WordPress Will Not Remove the Posts Per Page

You can set a specific value for the "Posts Per Page" variable in WordPress to entirely remove the posts per page limitation on the category page. To properly remove the posts per page on your WordPress site, you should understand how the content management system handles pagination on a default installation or basic theme. By learning about the WordPress's main loop, the "Query Posts" function and "Posts Per Page" variable, you'll be adequately prepared to edit the WordPress code with confidence.

  1. Pagination

    • By default, pagination is automatically enabled on a WordPress installation. Pagination controls how many posts appear on category pages. A site visitor can then click a link to move to the next set of posts on the second and all subsequent pages. Since WordPress is a highly customizable platform, you can alter the code to display posts as you would like on your website, removing the number of posts per page limit.

    Query Posts

    • Using the "Query Posts" function alters WordPress' main loop. The main loop contains a set of specific functions that are used on all default WordPress installations, unless a specific theme chooses to display the main loop differently. "Query Posts" can be used to display a specific category from a desired year, such as "Category 3" from "2004" or to pull in posts that contain the same tag.

    Posts Per Page

    • The "Posts Per Page" variable in the "Query Posts" function is used to change the number of posts per page limit to something other than the default value. You could increase the limit from 10 to 20 posts per page if you wanted. As well, you can entirely remove a limit, allowing for the full amount of posts to display on the WordPress category page.

    How To Remove

    • To remove the posts per page limit in WordPress, go to your administration page and sign into your account. Go to the "Appearance" panel on the left-hand side and click the "Editor" link. Click the "Category Template" link from the right-hand side. Find the "<?php get_header();?>" PHP code and change it to reflect this new code, "<?php get_header(); query_posts( 'posts_per_page=-1&amp;cat=' . $cat ) ?>" instead. Notice how the value for the "posts_per_page" variable is set to "-1" which tells WordPress to remove pagination and show all posts for that category. Click the "Update File" button to enable the changes on your WordPress site.

Related Searches:

References

Comments

Related Ads

Featured