WordPress.org

Ready to get started?Download WordPress

Forums

Custom Content Types in Multisite (11 posts)

  1. Topher
    Member
    Posted 3 years ago #

    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?

  2. 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.

  3. Topher
    Member
    Posted 3 years ago #

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

  4. 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/

  5. 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.

  6. Thanks mordauk, you're awesome. :)

  7. bondzinho
    Member
    Posted 2 years ago #

    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?

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

  9. bondzinho
    Member
    Posted 2 years ago #

    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

  10. 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.

  11. bondzinho
    Member
    Posted 2 years ago #

    OH MAN!! mordauk!

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

    So excited.

    thanks

Topic Closed

This topic has been closed to new replies.

About this Topic