In Genesis, site admins can add custom scripts (JavaScript) on a per-page basis using the Scripts meta box on the page’s edit screen. This is a useful feature for adding some custom JavaScript that should only be output on one page. For example, if you want to add some specific tracking script to a particular landing page, the page-specific script input lets you do this.
By default, the Scripts meta box is enabled only on Pages. If you want to use the setting on other post types (i.e. Posts, Products, etc.), you must add a line of PHP to your functions.php:
// Add support for the Genesis Scripts meta box on a custom post type add_post_type_support( 'download', 'genesis-scripts' );
Here, I added support for the “download” custom post type (Easy Digital Downloads). To add it to some other post type, change the first parameter to the appropriate post type. You can also pass an array of post types if you want to enable the meta box on more than one post type.
Leave a Reply