Home » WordPress » How To Display Custom Post Type In Front-End

How To Display Custom Post Type In Front-End

Here the question is once we created Custom Post Type how to display those posts in Front-end? For that here, we have a solution to display the custom post type in Front-end. By duplicating the single.php and archive.php, we can display the custom post type content in Front-end.

Once duplicated the template then we need to rename the template based on the custom post type name which we created. If you have not created the custom post type here you have an article using this you can create the CPT.

Rename The Template Name For Custom Post Type

Here now, I show you how to duplicate and rename the existing single.php and archive.php template for the created custom post type. Use the following steps to display the Custom Post Type posts in front-end.

Step-1: Open theme folder by using FTP, cPanel, or File Manager plugin.

Step-2: In the theme folder copy/duplicate the single.php and rename to single-custom-post-type-name.php like single-resources.php

Rename single.php template to view the post for Custom Post Type

Step-3: As like the single.php here we going to do with archive.php to archive-taxonomy-name.php like archive-resources.php

Rename archive.php template to list the category for Custom Post Type

Step-4: Once you completed these steps now you need to reupdate the Permalinks, make sure you selected Post name. (Settings -> Permalinks -> Post name-> Save Changes)

permalink update for custom post type

Note: Need to replace resources to create Custom Post Type by you. If you created yet here you have an article without a plugin you can create Custom Post Type.

The final output:

Below you can see how the created Custom Post Type will display in the front-end.

How To Display Custom Post Type In Front End

Conclusion: I hope this article will help you to display the custom post type posts in Front-end. If you have any questions about this toping use the comment box and let me know. If you like this article share it with your friends.

Was this article helpful?

Yes No
×

How can we improve it?

×

We appreciate your helpul feedback!

Your answer will be used to improve our content. The more feedback you give us, the better our pages can be.

Follow us on social media:

Facebook Pinterest

Mraj

Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts.

Leave a Reply

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

Back to top