I have installed the Custom Post Type UI plugin. After activation of this plugin I have created a custom post type called
portfolio. Now I want to use this on the portfolio page in the front-end. How do I fetch all post that are of custom post type
This question appears to be off-topic. The users who voted to close gave this specific reason:
witch shows both normal posts and posts inside 'portfolio'
For only portfolio.
Use as normal WP Query - read the Codex: http://codex.wordpress.org/Function_Reference/query_posts#Usage and http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters
Late answer as the main answer uses
Use a filter
The above code is a plugin, but can simply get stuffed in the
Add this code to your child themes functions file (recommended) to add your single CPT pages to your main loop
Or create a custom archive-portfolio.php page template which will only display your CPT pages. This only needs to be done if you haven't added a archive page using the plugin settings.
Example: 'has_archive' => true,
You can also control how many pages are displayed and the order in which they're displayed on the archive page using this code: