Answer the question
In order to leave comments, you need to log in
Why isn't is_page working?
Good afternoon. You need to include styles only on the blog page, but the condition is not met. How to decide?
if( is_page(15944) ){
wp_enqueue_style( 'blog_style', get_stylesheet_directory_uri() . "/css/style_blog.css", false );
}
Answer the question
In order to leave comments, you need to log in
is_page - for pages
is_single - for writing
////////////////
function my_styles() {
if ( is_page( '933' ) ) {
//подключаем стиль
wp_enqueue_style ( 'contact', get_template_directory_uri()
. '/altercss.css', array(), '1.0' );
//подключаем скрипт
wp_enqueue_script('alterscript', get_template_directory_uri() . '/alterscript.js');
}
}
add_action( 'wp_enqueue_scripts', 'my_styles' );
//////////////////
As far as I can see, the problem can be in 2 places:
1. Page 15944 does not exist
2. Wp_enqueue_style is not used correctly ( Function Reference / wp enqueue style )
Most likely, you need to dig towards 2 points.
Detailed example: Load plugin styles only on its pages
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question