I learn many Q&As right here on SO…(and elsewhere however they do not rely…lol)
I feel I comply with the principles of WP.org however nonetheless it doesn’t load the scripts.
Situation:
Customized template for publish in Php:
<?php
/*
* Template Identify: YYY
* Description: Kind for YYY donation.
* NO FOOTER
*/
get_header(); ?>
<div id="content-yyy">
theme capabilities.php
perform donate_adding_scripts() {
wp_register_script('donateParsleyJs', get_template_directory_uri() . '/js/parsley.min.js', array('jquery'),'1.11.1');
wp_enqueue_script('donateParsleyJs');
wp_register_script('donateParsleyHeJs', get_template_directory_uri() . '/js/he.js');
wp_enqueue_script('donateParsleyHeJs');
wp_register_script('donateJs', get_template_directory_uri() . '/js/donateJs.js', array('jquery'),'1.11.1', true);
wp_enqueue_script('donateJs');
}
perform donate_adding_styles() {
wp_register_script('donateStyle', get_template_directory_uri() . '/donateStyle.css');
wp_enqueue_script('donateStyle');
}
perform loadDonateScripts() {
if (is_single()) {
international $publish;
if($post->ID=="8436"){ // just for publish Id = 8436
add_action( 'wp_enqueue_scripts', 'donate_adding_scripts' );
add_action( 'wp_enqueue_scripts', 'donate_adding_styles' );
}
}
}
add_action( 'wp_enqueue_scripts', 'loadDonateScripts');
As I’m utilizing a setLocal for parsleyjs I’ve
<script sort="textual content/javascript">
window.ParsleyValidator.setLocale('he');
</script>
I’ve a number of points:
- the addition to capabilities.php doesn’t load the CSS
- the JS scripts solely load if I add
$in_footer=true
to capabilities.php file andget_footer();
to the php template - All that stated I want to load these just for the precise customized publish (ID=8436) therefore
perform loadDonateScripts()
I want to have the scripts loaded(clearly…duh), ideally within the footer…
Any concepts??