366 posts WordPress Guy
    Has referred 1+ members Has sold $100+ on Envato Market Has collected 50+ items on Envato Market Member of the Envato Team
+5 more
Japh Envato team says


If you’re implementing a completely new type of content that’s not a post, then I wouldn’t expect that you’d use CPTs.
That’s precisely what the CPT system was created for. I’m sure I could pull up a few of the original dev conversations if I dug around for them.
Yeah! If you can track some of those down, that would be helpful. I don’t even know where I would go to find something like that. Is there a repository somewhere? I feel like Tyler Durden when the body guard is beating the crap out of him and he’s all “nope, still not getting it.” ;)

Hi Scott,

To hopefully save Justin some time, and because I was interested in having some documentation in my arsenal about this anyway, I’ve found a few resources for you on the topic.

Mark Jaquith, WordPress core lead developer, wrote an article called Post Formats vs. Custom Post Types which has a good paragraph on this:

These were poorly named. Think: Custom Content Types. That is, non-post content. Examples: employees, products, attachments, menu items, pages, pets. If you want it to show up in your site’s main RSS feed, then it’s probably not a custom post type.

There are also a number of Trac tickets related to this. One particular comment on ticket #9674 is a good read.

I hope that helps clarify what WordPress’ core development team had in mind with custom post types anyway :)

32 posts
    Has collected 1+ items on Envato Market Located in United States Sells items exclusively on Envato Market Has been part of the Envato Community for over 3 years
dyspersion says

To hopefully save Justin some time, and because I was interested in having some documentation in my arsenal about this anyway, I’ve found a few resources for you on the topic.
Awesome, thanks for sharing, Japh! I’ll check these out…
21 posts
    Has been part of the Envato Community for over 3 years Sells items exclusively on Envato Market
amabil says

Sorry guys, but I thing that all of you are wrong. Should data be available to users after they switch a theme? No doubt. But is that a responsibility of theme developers? No. They register post types. They never unregister them. Just Wordpress is suffering from amnesia. Theme never offers access to custom post types, but WordPress handles the process of creating, updating and retriving post types, so is its responsibility to keep doing so until custom post types are explicit unregistered. So, solution lies in hands of WordPress developers. Make custom post type registration persistent and solve this issue not only for the future themes, but for older themes too, About shortcodes. How they work? The writer types [column_one]...[/column_two], the Wordprress saves this in database, then the redear requests a post and Wordpress processes shortcode and serves results to the reader. After that, a second user makes the same request, Wordpress processes again shortcode. Waste of energy, bad for tropical forests. Why? Wouldn’t be more logical to do_shortocode before the post is saved and to save the result of shortcode, not the shortcode itself in the database? I know, there are shortcodes that produce dynamic output, like a list of latest posts. But in this case the user no longer edits a post, he/she becomes a developer and is editing a template. And if so, a proper tool should be provided to them.

4 posts
    Has been part of the Envato Community for over 3 years Sells items exclusively on Envato Market
chipbennett says

Sorry guys, but I thing that all of you are wrong. Should data be available to users after they switch a theme? No doubt. But is that a responsibility of theme developers? No.

If a Theme registers a custom post type, then it absolutely is the Theme developer’s responsibility to ensure that user data created using that CPT is available to the end user.

They register post types. They never unregister them.

End user statistics regarding Theme switching refute such an assertion. Theme developers must assume that any given Theme WILL be deactivated at some point, because the end user WILL switch to a different Theme at some point.

Just Wordpress is suffering from amnesia.

No; that’s how the PHP execution loop works.

Theme never offers access to custom post types…

Um, what…? If it is the Theme that registers the CPT , then what is it, if not the Theme, that “offers access” to that CPT ?

but WordPress handles the process of creating, updating and retriving post types…

No. It is not WordPress core that calls register_post_type(), but rather the Theme.

...so is its responsibility to keep doing so until custom post types are explicit unregistered.

When a CPT is registered via a Theme, then switching Themes is an explicit unregistering of that CPT .

So, solution lies in hands of WordPress developers. Make custom post type registration persistent and solve this issue not only for the future themes, but for older themes too,

WordPress already has a way for custom post types to be persistent through Theme activation and switching: register CPTs via Plugin, rather than via the Theme.

Your argument makes absolutely no sense, given the way PHP and the WordPress Plugin API works. If a Theme registers a custom post type, then when the Theme is deactivated, that CPT no longer gets registered during the execution loop. You’re only furthering the argument for not registering CPTs via Themes, but rather via Plugin.

About shortcodes. How they work? The writer types [column_one]...[/column_two], the Wordprress saves this in database, then the redear requests a post and Wordpress processes shortcode and serves results to the reader. After that, a second user makes the same request, Wordpress processes again shortcode. Waste of energy, bad for tropical forests. Why? Wouldn’t be more logical to do_shortocode before the post is saved and to save the result of shortcode, not the shortcode itself in the database? I know, there are shortcodes that produce dynamic output, like a list of latest posts. But in this case the user no longer edits a post, he/she becomes a developer and is editing a template. And if so, a proper tool should be provided to them.

That’s an argument to take up with the core WordPress developers. Otherwise, it is the responsibility of Theme developers to support core’s implementation of a given feature, including do_shortcode(). As it is, do_shortcode() is parsed at runtime, so Themes should be developed accordingly.

Your end users are far better served by developers who develop against what WordPress is, rather than those who develop against what the developer thinks WordPress should be.

1 post
    Has been part of the Envato Community for over 4 years Has collected 50+ items on Envato Market
gideon625 says

i’ve read through most of this thread and, as an end user, it’s quite eye opening. as end users, we aren’t educated enough to know the difference, but as soon as we take the time to learn or get tired of having to ‘fix’ our websites between themes, we’ll take notice, and that’s when the marketplace will begin adjusting itself. because we won’t (i know i won’t anymore) buy themes that will keep us beholden to them.

if this is a big enough problem, and the developers and reviewers at themeforest don’t make the change, themeforest will be to a competitor what ibm was to microsoft, easy prey.

7 posts
    Has been part of the Envato Community for over 1 year Located in Canada Sells items exclusively on Envato Market
SunnyThemes says
But, my users benefit from having their content represented in different sections in the admin. Enter CPTs.
You should be extending the WordPress UI for something like that rather than building CPTs unless you truly have different types of content.

This is something I am really interested in finding a solution for. Right now I can define a CPT of “News” then it will appear as a heading on the admin dashboard. This is ideal for the user interface. But, as this thread argues, this content really belongs as a post with category “News”. But if I use a post with category “News”, then the client must know to select the “News” category when entering a new post and they don’t have a nice “News” menu item.

To solve this I am currently researching ways to add a menu heading for a post category. I can’t find any mention of this on google so I wonder if anybody has any insight into whether this is possible.

2444 posts
    Has referred 100+ members Has sold $100+ on Envato Market Has been a beta tester for an Envato feature Has collected 10+ items on Envato Market
+3 more
digitalimpact says

^ if you need to only rename the “Posts” menu item label to “News”, don’t duplicate WordPress functionality by using custom post types for what they are not. Instead, simply rename them:

function my_change_post_menu_label() {
    global $menu, $submenu;
    $menu[5][0] = 'News';
    $submenu['edit.php'][5][0] = 'News';
    $submenu['edit.php'][10][0] = 'Add News';
    $submenu['edit.php'][16][0] = 'News Tags';
    echo '';
}
function my_change_post_object_label() {
    global $wp_post_types;
    $labels = &$wp_post_types['post']->labels;
    $labels->name = 'News';
    $labels->singular_name = 'News';
    $labels->add_new = 'Add News';
    $labels->add_new_item = 'Add News';
    $labels->edit_item = 'Edit News';
    $labels->new_item = 'News';
    $labels->view_item = 'View News';
    $labels->search_items = 'Search News';
    $labels->not_found = 'No News found';
    $labels->not_found_in_trash = 'No News found in Trash';
}
add_action( 'init', 'my_change_post_object_label' );
add_action( 'admin_menu', 'my_change_post_menu_label' );

As mentioned above, if you want it to show up in your site’s main RSS feed, then it’s probably not a custom post type.

7 posts
    Has been part of the Envato Community for over 1 year Located in Canada Sells items exclusively on Envato Market
SunnyThemes says

That would be a good solution if I only needed one post category. I am thinking of having several categories, such as blog, news, portfolio, each with a main menu heading. Ideally adding a new post under the heading would automatically set the post category.

7 posts
    Has been part of the Envato Community for over 1 year Located in Canada Sells items exclusively on Envato Market
SunnyThemes says

This is close but doesn’t auto-fill category when adding a new post:

add_action('admin_menu', 'register_custom_menu_page');
function register_custom_menu_page() {
   add_menu_page('Portfolio', 'Portfolio', 'edit_posts', 'edit.php?category_name=portfolio', '', '', 6);
}
1 post
    Has been part of the Envato Community for over 1 year Has collected 1+ items on Envato Market Located in Europe
Kry_spin says

Hi, I stumbled over this discussion when searching for a solution how to keep my content, when changing themes. By content I mean content with shortcodes that adjust how the content is displayed. I’m an end user, but I’m capable of making things like custom post types and custom fields and then displaying them (using clever plugins). However, I’m not capable of styling the theme, I cannot not build the shortcodes (I struggle enough using them). The trouble is, that – the shortcodes are usually not compatible. Esp. when buying theme from a different author. So instead of having a great new look, I have awkward looking text (if I’m lucky). Even if I try to load demo content from one theme and then switch to another, the content usually does not display at all, or it certainly does not look nearly close to what it should. It might be a silly question, but is there a way out of this? Can I somehow replace old shortcodes with new ones (providing they have the same or similar functionality). Or do I have to rebuild the site pretty much from the scratch? Or should I take a totally different approach?

by
by
by
by
by
by