Support » Plugin: Jigoshop » Jigoshop includes CSS and JS on all admin pages

  • Resolved Sayontan Sinha


    This plugin is great, but there is a major issue in the back-end, interfering with the behaviour of other plugins and themes.

    When you visit different admin screens, you see these lines in the source code:

    <link rel='stylesheet' id='jigoshop_admin_styles-css'  href='.../wp-content/plugins/jigoshop/assets/css/admin.css?ver=3.3.2' type='text/css' media='all' />
    <link rel='stylesheet' id='jquery-ui-jigoshop-styles-css'  href='.../wp-content/plugins/jigoshop/assets/css/jquery-ui-1.8.16.jigoshop.css?ver=3.3.2' type='text/css' media='all' />

    These lines show up even if you are in non-Jigoshop admin screens. This causes conflicts with plugins/themes that have their own skinning included. The trouble comes from this code:

    add_action( 'admin_enqueue_scripts', 'jigoshop_admin_styles' );
    function jigoshop_admin_styles() {
    	wp_register_style('jigoshop_admin_styles', jigoshop::assets_url() . '/assets/css/admin.css');
       	wp_register_style('jquery-ui-jigoshop-styles', jigoshop::assets_url() . '/assets/css/jquery-ui-1.8.16.jigoshop.css');

    The right way to include the code would be to use the appropriate options page hook. E.g. In the file jigoshop-admin.php, the call to add_menu_page returns a page. That returned value should be stored as a global variable. The jigoshop_admin_styles takes a page hook as a parameter by default, and there should be a check before including the scripts if the global variable options page is the same as the hook being passed.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Jigoshop includes CSS and JS on all admin pages’ is closed to new replies.