• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
WPFeed

WPFeed

  • News
  • Tutorials
    • WordPress Multisite
    • BuddyPress
    • Design
  • Reviews
    • Plugins
  • Roundups
  • Snippets
  • Giveaways
Home » BuddyPress » How to Overwrite Number of Posts on Custom Post Types Archive Page

How to Overwrite Number of Posts on Custom Post Types Archive Page

WordPress has an option to allow you to choose number of post to be displayed in your site. This option can be seen from Writing settings page.

number-of-post

The number you set here is the number of post that will be displayed on all archive pages, including the archive page for Custom Post Type (CPT). However, there’s a way to overwrite this number of post to be displayed on your CPT archive page.

This code should go into functions.php file of your child theme. The code is self-explanatory. We use pre_get_posts filter to overwrite the number of post in portfolio post type. Simply replace 'portfolio' with the name of your CPT.

If you’re new to CPT, here are some great tutorials we’ve published about CPT:

  1. Creating Your First Custom Post Type
  2. Custom Post Type Code Generator
  3. Adding Custom Post Types to Main Feed
  4. Switch Post to Custom Post Type or Vice Versa

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • WordPress is a brilliant platform that is loaded with tons of stuff for websites.
  • How to Sync Stock & Price for WooCommerce Products
  • How to migrate a WooCommerce Store to a new site
  • How to Import WooCommerce Products
  • How to export WooCommerce Orders

Copyright © 2023 · WPFeed.com - A Project of TechAbout LLC.

  • About us
  • Advertise
  • Write for us
  • Terms and Conditions
  • Privacy Policy
  • Contact us