There’s 2 ways to add the scripts box to custom post types edit screen:
1. You can use code in your functions file like this:
function add_support_genesis_scripts() {
add_post_type_support( 'portfolio', 'genesis-scripts' );
}
add_action( 'init', 'add_support_genesis_scripts' );
Swap out portfolio in the code above to the name of your custom post type.
2. Add 'genesis-scripts'
in the comma separated array of values for the 'supports'
parameter when using the register_post_type function to create your CPT.
'supports' => array( 'genesis-scripts' ),
Here it is included in the complete code as the 2nd last parameter:
add_action( 'init', 'add_portfolio_post_type' );
function add_portfolio_post_type() {
register_post_type( 'portfolio',
array(
'labels' => array(
'name' => __( 'Portfolio', 'genesis' ),
'singular_name' => __( 'Portfolio', 'genesis' ),
),
'has_archive' => true,
'hierarchical' => true,
'menu_icon' => 'dashicons-admin-users',
'public' => true,
'rewrite' => array( 'slug' => 'portfolio', 'with_front' => false ),
'supports' => array( 'genesis-scripts' ),
'taxonomies' => array( 'portfolio-type' ),
));
}
Was This Tutorial Helpful?