• Resolved Sean Thompson

    (@seanthompson)


    Hi,

    I’m wondering if it’s possible to only load this plugin’s scripts and styles on shop pages.

    Thanks in advance,
    Sean

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ndre

    (@ndre)

    Hi @seanthompson,

    You should use the following code to load it only on catalog pages:

    add_action('wp', 'ic_filter_catalog_styling', 5);
    
    function ic_filter_catalog_styling() {
       if (!is_ic_catalog_page()) {
          remove_action('wp', array(impleCode_EPC(), 'implecode_register_styles'));
       }
    }
    • This reply was modified 11 months, 1 week ago by ndre.

    Thank you. That worked perfectly, except…

    <link rel='stylesheet' id='dashicons-css' href='/wp-includes/css/dashicons.min.css' media='all' />

    is still loading.

    Plugin Author ndre

    (@ndre)

    Hi @seanthompson,

    Please use the following code to also prevent loading the dashicons:

    add_action('wp', 'ic_filter_catalog_styling', 5);
    
    function ic_filter_catalog_styling() {
       if (!is_ic_catalog_page()) {
          remove_action('wp', array(impleCode_EPC(), 'implecode_register_styles'));
          remove_action( 'wp_enqueue_scripts', array( impleCode_EPC(), 'implecode_enqueue_styles' ), 9 );
       }
    }

    That did the job. Thank you very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dequeue Assets’ is closed to new replies.