• Hey guys,
    I am kind of stuck with 2 plugins who won’t quite like each other. Both work fine when alone but kills each other when used simultaneously.

    So what I figured out was that the problem is with the .js and / or .css script that it calls in the <head> tag.

    Hence, I want to know, is there a plugin or a way that I can let the plugin add the scripts in the <head> tag only on certain page?

    I’m sure we can add an If condition where it adds the scripts. Something like:

    If(is.page/category-id){
    add stuff before </head> ; }

    Not quite a wordpress coder, could you please provide the script to how I add this condition?

    Note: Both the plugins are used only on their dedicated pages. So the code can be to exclude one on a particular page, or include it only on a particular page. Whichever is convenient. (I’d prefer inclusion though)

    Thanks a lot,

    Cheers,
    Jugal

Viewing 1 replies (of 1 total)
  • When you enqueue the script put in a condition.

    function my_enqueue() {
        if (is_page('scriptpage')) {
            // wp_enqueue goes here
        }
    }
    // add_action goes here
Viewing 1 replies (of 1 total)
  • The topic ‘Load page specific .js / .css scripts in head tag’ is closed to new replies.