Forum Replies Created
Viewing 1 post (of 1 total)
-
AuthorPosts
-
dukecreativeMemberHi Jason,
Thanks for your reply, I ended up using the following to restrict loading to the post type:
global $pagenow; if ( 'post.php' === $pagenow && isset($_GET['post']) && 'your_post_type' === get_post_type( $_GET['post'] ) ){ add_filter('piklist_assets', 'plugin_assets'); function plugin_assets($assets) { array_push($assets['scripts'], array( 'handle' => 'plugin-scripts', 'src' => plugins_url('/your_plugin_name/parts/js/scripts.js'), 'ver' => '1.0', 'deps' => 'jquery', 'enqueue' => true, 'in_footer' => true, 'admin' => true, 'front' => false )); return $assets; } }This ensures assets are loaded only where required and not globally.
-
AuthorPosts
Viewing 1 post (of 1 total)