Quantcast
Viewing all articles
Browse latest Browse all 10

Pages, pagination and Custom Post Type

Image may be NSFW.
Clik here to view.
Custom Post Type Project

The problem which I meet today seems to be a simple one but it took me some hours to fix it. It’s about displaying pagination for Custom Post Type in a page.

I registered a custom post type “projects” and I wanted to display all projects into the page which I called “Projects“.

I created a template “template-project.php” file where I have a loop to get all projects.

I edited the page “Projects“, and selected the template “Projects template“.

Everything works perfectly except the pagination. When I click on next page it displays the content from a specific post instead of the second page with a list of projects.

You can’t create a “page” which has the same name as you registered your custom post type, in my case “projects“. Give other name to you page or change the permalink and the issue will be fixed.

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 10

Trending Articles