I’m battling with an issue for months now, that my code won’t execute or present the end result, once I enqueue it. I’ve been informed, that my code is ok, and that it ought to work.
The clock is displaying, so the css and html is appropriate, however not doing something.
Right here it’s:
<?php
operate childtheme_parent_styles() {
wp_enqueue_style( 'mother or father', get_template_directory_uri().'css/model.css' );
operate mytheme_files() {
wp_enqueue_style('mytheme_main_style', get_stylesheet_uri());
wp_register_script('main-js', get_stylesheet_directory_url() . '/js/predominant.js');
}
add_action( 'wp_enqueue_scripts', 'childtheme_parent_styles');
wp_register_script('main-js',get_stylesheet_directory_url().'/js/predominant.js');
}
add_action( 'wp_enqueue_scripts', 'pr_scripts_styles' );
}
operate pr_scripts_styles() {
if( is_page(507) ) {
wp_enqueue_script( 'main-js');
}
The js code is in a folder named js and in a file named predominant.js
setInterval(() => {
d = new Date(); //object of date()
hr = d.getHours();
min = d.getMinutes();
sec = d.getSeconds();
hr_rotation = 30 * hr + min / 2; //changing present time
min_rotation = 6 * min;
sec_rotation = 6 * sec;
hour.model.remodel = `rotate(${hr_rotation}deg)`;
minute.model.remodel = `rotate(${min_rotation}deg)`;
second.model.remodel = `rotate(${sec_rotation}deg)`;
}, 1000);
<?php
operate childtheme_parent_styles() {
wp_enqueue_style( 'mother or father', get_template_directory_urI().'/css/model.css' );
operate mytheme_files() {
wp_enqueue_style('mytheme_main_style', get_stylesheet_uri());
wp_register_script('main-js', get_stylesheet_directory_uri() . '/js/predominant.js');
}
add_action( 'wp_enqueue_scripts', 'childtheme_parent_styles');
wp_register_script('main-js',get_stylesheet_directory_uri(). '/js/predominant.js');
}
add_action( 'wp_enqueue_scripts', 'pr_scripts_styles' );
}
operate pr_scripts_styles() {
if( is_page(507) ) {
wp_enqueue_script( 'main-js');
}
Will verify the dev instruments.