• Resolved tonythetiger

    (@gcskye)


    The style sheets used in this plugin break many of my pages and add styling to pages where it shouldn’t. Each release I have to go in and set the script to only load on specific pages.

    I’ve tried the following code but it isn’t working.

    function applyjobs_deregister_javascript_css() {
        if ( ! is_page( '27066' ) ) {
            wp_deregister_script( 'apply-online-BS-css' );
    	wp_deregister_script( 'aol-jquery-ui-css' );
    	wp_deregister_script( 'apply-online-css' );
            wp_deregister_style( 'apply-online-js' );
        }
    }
    
    add_action( 'wp_enqueue_scripts', 'applyjobs_deregister_javascript_css', 100 );
    

    How can I get the CSS and JS to only load on the front end pages the plugin is active?

Viewing 1 replies (of 1 total)
  • Plugin Author Farhan Noor

    (@farhannoor)

    Hi there,

    I can see you applied wrong function to a script type. wp_deregister_script() function should be applied to JavaScript files & wp_deregister_style() should be applied to CSS files. Also try deregistering CSS & JS scripts without css & js suffix. e.g wp_deregister_style('apply-online-BS'); See, i did not write apply-online-BS-css

    I hope it will solve your problem.

    Best
    Farhan

Viewing 1 replies (of 1 total)
  • The topic ‘Styling breaking plugins and pages’ is closed to new replies.