• Resolved NeiltheSpacechimp

    (@neilthespacechimp)


    I have a multisite version of wordpress running. I have created a couple of master themes which clients on the multisite network have access to. As part of the theme I would like to create a custom post type however since it would be used by multiple clients for multiple purposes is it possible to rename the CPT on a site to site basis?

    For example one client may use the theme’s custom post type to list SERVICES. Another client using the same theme and same CPT may want to list PRODUCTS. I’d like a way to mask the true CPT name and make it appear with a name set by the client in both the URL & dashboard menu.

    Is what I’m asking for even possible? I’m not sure what to search for in terms of possible plugins or theme development.

    Thanks in advance

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    is it possible to rename the CPT on a site to site basis

    Nope. You’d have to make separate ones per site.

    That said, you can allow them to edit the display name by getting a theme with custom CPT archives and such, but the URL slug is not changeable.

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Thanks Mika for once again supplying an answer to one of my posts. In the meantime I did a little research of my own and of course you are dead right.
    I should point out this plugin, for the sake of anyone who finds this post in search of similar answers Custom post type editor. It allows you to edit the labels of a CPT but as Mika explains the URL slug cannot be changed.

    I must admit I’m not sure why this is. Couldn’t we add a function based on this line:
    ‘rewrite’ => array( ‘slug’ => ‘New_name’ ),
    when creating a CPT?

    In order to achieve what I’m after I am attempting to develop my own plugin which creates both the custom post type and a widget to display it on the home page. The widget allows me to set a number of the CPT titles to display within the widget options. I’ve managed this so far without a hitch. My next plan is to add a text field in the widget(?) which will change the CPT labels and slug. Using this method I hope to still be able to create theme templates with the CPT’s original name IE single-original_name.php and archive-original_name.php

    I assume from what both you (Mika) an the Custom post type editor plugin developer have said that this last step will cause me problems?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I must admit I’m not sure why this is. Couldn’t we add a function based on this line:
    ‘rewrite’ => array( ‘slug’ => ‘New_name’ ),
    when creating a CPT?

    Because then you’ve made a new CPT.

    It helps if you’ve actually looked at the DB tables for this. In wp_posts, you’ll see a ‘type’ field. That’s what actually defines the posttype. So for posts it’s ‘post’ and page is ‘page’ and so on and so forth.

    In order to make CPTs less prone to conflicts, when you create them you define a slug for the type. Changing that will cause memory issues with your permalinks, and possible conflicts with data.

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Ahh I understand. In that case I will rethink my plugin. I’ll have to make the plugin create the CPT based on user preferences on a settings page rather than renaming the labels after creation. I’m sure I can figure that out …. probably.

    Thanks again for helping me

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    You may want to look into the CPT UI plugins then. I don’t love ’em, but they let you make per-site CPTs easiely.

    Thread Starter NeiltheSpacechimp

    (@neilthespacechimp)

    Yea that seems to be the way I’m headed. Looking at the existing CPT UI plugins on the WP Plugin directory yields some interesting results. I think I need something simpler than most here but it’s a great jump off point.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Rename Custom post type in a multisite on a site to site basis’ is closed to new replies.