If your theme requires a helper plugin (to handle CPTs, taxonomies, etc.), you must bundle the plugin as a .zip file inside your theme directory (e.g., in a /plugin/ folder). Use the TGMPA (TGM Plugin Activation) library to declare it as a required asset.
Note: Do not host the plugin in a remote location for installation; it must be included within the theme zip.
add_action( 'tgmpa_register', 'mythemename_register_required_plugins' );
function mythemename_register_required_plugins() {
$plugins = array(
array(
'name' => 'ThemeName Plugin Name',
'slug' => 'themename-helper-plugin',
'source' => get_template_directory() . '/plugin/themename-helper-plugin.zip',
'required' => true,
'force_activation' => false,
'force_deactivation' => false,
),
);
$config = array(
'id' => 'themename',
'default_path' => '',
'menu' => 'tgmpa-install-plugins',
'has_notices' => true,
'dismissable' => true,
'dismiss_msg' => '',
'is_automatic' => false,
'message' => '',
);
tgmpa( $plugins, $config );
}