181 posts
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+3 more
MCStudios says

Hi everyone, i’m using a custom post type to create some case studies, but i want that every post created in that custom post type be displayed in a page.

I’ve being using custom post types to manage portfolios, sliders, etc. but never to create pages

this is how my custom post type look:

add_action( 'init', 'mcw_projects_post_type' );

function mcw_projects_post_type() {

    register_post_type( 'projects', array(
        'labels' => array(
            'name' => __('Projects'),
            'singular_name' => __('Project')
            ),
        'public' => true,
        'show_ui' => true,
                'hierarchical' => true,
                'publicly_queryable' => true,
        'can_export' => true,
        'capability_type' => 'page',
                'supports' => array('title', 'editor', 'page-attributes', 'thumbnail'),
        'rewrite' => array(
            'slug' => 'project',
            'with_front' => false
            ),
        'has_archive' => true
    ) );

}

But in my custom post type the option to choose a page template is not displayed and i’m not sure how to create the page to display the case study.

I don’t want to loop all the cases and display them in a page, i need that every post created in that custom post type be displayed in a separated page.

Well if anyone have experience on this i appreciate any help. :)

1029 posts
  • Has referred 500+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
ThemeBlvd says

Sorry if I’m misunderstanding your question, but a custom post type is not a “page” or a “post”. So, to create specific layout for your custom post type individual pages, you’d create a file named single-NAME-OF-POST-TYPE.php. If this file doesn’t exist, then WordPress will fall back to single.php

181 posts
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+3 more
MCStudios says

Sorry if I’m misunderstanding your question, but a custom post type is not a “page” or a “post”. So, to create specific layout for your custom post type individual pages, you’d create a file named single-NAME-OF-POST-TYPE.php. If this file doesn’t exist, then WordPress will fall back to single.php

Ok i will try to explain me better, i’ve created the post type and i have my single-posttype.php, everything works correctly.

What i want to know if there is any way that when i create a new post in this custom post type, i want the post be displayed in the menu (like when you create a page).

16 posts
  • Has been part of the Envato Community for over 5 years
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
saramw08 says

What kind of menu, manu? If you’re not trying to feed post titles into the wp_nav_menu then what you can do is setup a query for the custom post type and just output the post titles with an anchor wrapped around each one.

“query_posts( ‘post_type=page’ );”

The above query gets content by post type, but you need to put your post type’s name where the example says “page.” I use this on one page, also, to put some stuff from a custom post type on.

If you want to make a page that will automatically show up on your main menu, you can make a custom page template containing the query and then make a blank page and set that to use the custom page template. I guess that is sort of like what happens when you setup WP as a CMS and have to create a blank “blog” page. Except in that case, you don’t have to do the custom page template. In this case, you do.

Sorry if that’s not clear enough. I’ve been slugging it out with custom post types and complicated meta boxes all weekend.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by