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
Step-3: As like the single.php here we going to do with archive.php to archive-taxonomy-name.php like archive-resources.php
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)
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.
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.
Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts. If you have any questions let me drop an email with the article name to the following email id: [email protected]