I have a site specific plugin that I’ve written for the main site in my multisite network. Now I realize that the shortcodes that are in the plugin are also useful on the sub-sites, however the sub-sites don’t need all the code for custom post types and taxonomies.

How do I make just the shortcodes work for sub-sites? Is there a conditional I can use? Here’s how my plugin is currently set up:

// Plugin Directory 
define( 'CLICK_DIR', dirname( __FILE__ ) );

// General
include_once( CLICK_DIR . '/lib/functions/general.php' );

// Post Types
include_once( CLICK_DIR . '/lib/functions/post-types.php' );

// Taxonomies 
include_once( CLICK_DIR . '/lib/functions/taxonomies.php' );

// Shortcodes
include_once( CLICK_DIR . '/lib/functions/shortcodes.php' );

2 Answers
2

if ( is_main_site() ) {
    include_once CLICK_DIR . '/lib/functions/general.php';
    include_once CLICK_DIR . '/lib/functions/post-types.php';
    include_once CLICK_DIR . '/lib/functions/taxonomies.php';
}

include_once CLICK_DIR . '/lib/functions/shortcodes.php';

Leave a Reply

Your email address will not be published. Required fields are marked *