Support » Networking WordPress » Custom Content Types in Multisite

  • Topher

    (@topher1kenobe)


    I’m using the plugin “Easy Content Types” to create custom content types on my multi-site install.

    When I’m on the main site I can create content types, but then they’re not available on the child sites.

    In the child sites I can’t even create them. It says it did, but then they’re not listed.

    Is there a good path for making a custom content type, and then using it in multiple sites?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    Talk to the plugin author.

    If they wrote it for use on single WP sites, and did not try it in multisite…. then that’s an issue they have to fix. Especially if you paid for it.

    Usually, when you;re doing this type of thing for the whole network and you want it available for all sites, you’d do the coding yourself in the mu-plugins folder. NOT via a plugin.

    Topher

    (@topher1kenobe)

    I don’t have an mu-plugins folder, should I create it, and write a custom content types manager myself?

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    Yes. Same as the guy told you about putting the code in functions.php. Same stuff usually works in /mu-plugins/ and you’re not restricted by the theme.

    http://wpmututorials.com/basics/what-is-the-mu-plugins-folder/

    Moderator Pippin Williamson

    (@mordauk)

    Pippin's Plugins and Plugin Reviewer

    Topher, you asked me earlier if the plugin was compatible with multi site, and I said yes. What I did not realize is that you want to create post types on the main site and have them available on all sites. Usually people want to be able to control options for each individual site, not across individual sites.

    I this case, you would need to activate the plugin for the whole network (under network admin) then set up the post types on each site. Or, you can contact me via my profile on code canyon (so I can check that you purchased a license), and I will do a quick modification for you that will allow you to create the post types once and have them available on all sites.

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    Thanks mordauk, you’re awesome. 🙂

    that’s exactly what i’m looking for

    POST TYPES & CUSTOM FIELDS available to every site on a multi-site.
    mordauk, You can do this?

    Moderator Pippin Williamson

    (@mordauk)

    Pippin's Plugins and Plugin Reviewer

    If you comfortable working with the code, then I can show you what to do.

    Mordauk!

    thanks for the speedy reply. great great.

    and yes, i am pretty comfortable with code.
    I’ve done over a 1000 mods to my site using php and html.
    A little more fearful when it comes to sql.

    Tell me what i can do!!! I’m all ears.

    James

    Moderator Pippin Williamson

    (@mordauk)

    Pippin's Plugins and Plugin Reviewer

    What you need to do is place all of your code for the custom post types and meta boxes in a plugin file, and then network activate the plugin. So your plugin might look like this, more or less:

    /*
    Plugin Name: Custom Functions Plugin
    Plugin URI: http://pippinsplugins.com/
    Description: Put custom functions in this plugin
    Author: Pippin Williamson
    Author URI: http://pippinsplugins.com
    Version: 1.0
    */
    
    /////////////////////////////////////////////////
    // notice custom post type
    /////////////////////////////////////////////////
    function pippin_create_notices() {
    
    	$labels = array(
    		'name' => _x( 'Notices', 'post type general name' ), // Tip: _x('') is used for localization
    		'singular_name' => _x( 'Notice', 'post type singular name' ),
    		'add_new' => _x( 'Add New', 'Notice' ),
    		'add_new_item' => __( 'Add New Notice' ),
    		'edit_item' => __( 'Edit Notice' ),
    		'new_item' => __( 'New Notice' ),
    		'view_item' => __( 'View Notice' ),
    		'search_items' => __( 'Search Notices' ),
    		'not_found' =>  __( 'No Notices found' ),
    		'not_found_in_trash' => __( 'No Notices found in Trash' ),
    		'parent_item_colon' => ''
    	);
    
     	$annoucement_args = array(
         	'labels' =>$labels,
         	'singular_label' => __('Notice'),
         	'public' => true,
         	'show_ui' => true,
    	  	'capability_type' => 'post',
         	'hierarchical' => false,
         	'rewrite' => false,
         	'supports' => array('title', 'editor'),
         );
     	register_post_type('notices', $annoucement_args);
    }
    add_action('init', 'pippin_create_notices');

    So that will create a plugin called “Custom Functions Plugin”. Simply save the file as “custom-functions.php”, place it in your plugins/ folder and network activate it. You will need to add your meta box code to the plugin, obviously.

    OH MAN!! mordauk!

    i can’t wait to try this out tomorrow morning…coffee in hand. Programmer hat on.

    So excited.

    thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Custom Content Types in Multisite’ is closed to new replies.