• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Add Genesis Scripts Meta Box To Custom Post Types

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' ),
));
	
}

Custom Post Type Meta Box

Reader Interactions

Comments

  1. Gary says

    May 23, 2018 at 5:42 pm

    Works perfectly. Thank you.

    Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems