0

I want disable one specific page of the default css, and i want use my css on the specific page. I don't know it is posibble?

I use Blank State plugin, for create blank page, but css its on the blank pages, but i want my css use on the specific blank pages.

https://wordpress.org/plugins/blank-slate/

So, i have one page, that name: test-area-7 Code:

add_action('wp_enqueue_scripts', 'my_script', 99);
function my_script()
{
    if(is_page( 'test-area-7' )){
        wp_dequeue_script('fpw_styles_css');
    }
}

EDITED

    add_action('wp_enqueue_scripts', 'my_script', 99);
function my_script()
{
    if(is_page( 'test-area-7' )){
        wp_dequeue_script('/wp-content/themes/colormag/style.css');
    }
}

2 Answers 2

0

Disable CSS specific page for use conditional tag.

add_action('wp_enqueue_scripts', 'my_script', 99);
function my_script()
{
    if(is_page( 'Page name' )){
        wp_dequeue_script('fpw_styles_css');
    }
}

EDIT

 wp_dequeue_script('Your css name or id');

EDIT

Please check this link for more :

https://developer.wordpress.org/reference/functions/wp_enqueue_style/

How to use wp_dequeue_style() for style enqueued in WP_Widget class

 wp_enqueue_style( 'my-theme-ie', get_stylesheet_directory_uri() . "/css/ie.css");
wp_dequeue_script('my-theme-ie');
9
  • Huh, it is not working. Probably I'm doing something wrong.
    – Ever Thems
    Jul 7, 2017 at 12:19
  • put your code here. update your Question Jul 7, 2017 at 12:20
  • Added the code, of question.
    – Ever Thems
    Jul 7, 2017 at 12:26
  • edit my answer please check it Jul 7, 2017 at 12:28
  • So on the "Your css name or id" place the path my css?
    – Ever Thems
    Jul 7, 2017 at 12:30
0

instead of denqueue_script, why not put the conditional "if not the page" then "load my css"

function theme_styles() {
  if(!is_page( 'your-page-slug' )){
     wp_enqueue_style('theme-stylesheet', get_template_directory_uri() .'/assets/css/main.css');
  }else{
    wp_enqueue_style('my-custom-page-css', get_template_directory_uri() .'/assets/css/custom.css');
  }
add_action('wp_enqueue_scripts', 'theme_styles');

Place that in functions.php and should work. Not tested that though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.