child theme
-
I am trying to run jquery script in a child theme on a different subdirectory.
example
child function has following snipit
//************ begining
if ( !is_admin() );
function my_init_credit() {
wp_enqueue_script( ‘custom_script’,get_bloginfo(‘get_stylesheet_directory_uri’).’/js/hide_pay.js’,
array(‘jquery’));
//wp_enqueue_script( ‘custom_script’, ‘wp-content/themes/freelancer-child-1/js/hide_pay.js’,
//array(‘jquery’));
}
//This action ensures the my_init() function is called when a page loads.
add_action(‘init’, ‘my_init_credit’);
//*********************end
Hook in php page <?php wp_enqueue_script(“jquery”); ?>the page is in a subdirectory of the parent called lib/myaccount/xxxx.php so I have added that page to the child theme under the same sub directory structure and am referencing the .js files testing both directly and with get_bloginfo above. The .js directory and file is also in the child theme file
I have other hooks and jquery running fine but they are running in the header.php and are working fine
I cannot seem to get the js file to load in the file that is in the subdirectory of my parent theme either by placing it in the child directly or setting it up in the child with the same directory structure as in the parent.
I have checked firebug and the .js is not executing on that page.
the jquery code hides an element when the file is loaded.
I have run the jquery in firebug directly and it hides the element fine
//**********js code below*********
jQuery(document).ready(function(){
var par = jQuery(‘.post_bid_btn’);
jQuery(par).hide();
});Can anyone give me any in site into how to handle a php page other than the standard index or header or footer in the child theme to run a function from the child function.php
Thanks
rich
The topic ‘child theme’ is closed to new replies.