Not sure if my if( is_page(18) ) { is in the exact correct place
-
Hi, I am not sure where to exactly put my if( is_page(18) hook when I enqueue my script.
And I am confused about the action hook as well. Do I need to make another seperate action hook and say where exactly on the page I want my code to work.
Here is the full code:<?php function childtheme_parent_styles() { wp_enqueue_style( 'parent', get_template_directory_uri().'css/style.css' ); function mytheme_files() { wp_enqueue_style('mytheme_main_style', get_stylesheet_uri()); } add_action( 'wp_enqueue_scripts', 'childtheme_parent_styles'); wp_register_script('main-js',get_stylesheet_directory_url().'/js/main.js'); } add_action( 'wp_enqueue_scripts', 'pr_scripts_styles' ); } function pr_scripts_styles() { wp_enqueue_script( 'main.js'); if( is_page(18) ) { }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Not sure if my if( is_page(18) ) { is in the exact correct place’ is closed to new replies.