Tagged: child theme
Hi, we have added a child theme and copied the header.php into the child theme (we needed to add some code to the header.php) but it’s not picking up the revised header.php.
Please could you check why this isn’t working.
Thanks
Hey helenwhite,
What code have you added and what is the purpose of it?
Best regards,
Rikard
We are just adding this tooltop https://jqueryui.com/tooltip/. So added some code to the the child header.php.
We would like to add a tooltip to some of the timetable copy.
Is that ok? or can you suggest an alternative way of doing this?
Thanks
Hi!
Please add following code to Functions.php file of your child theme
function add_tooltip_js() {
wp_enqueue_script( 'tooltip-js', get_template_directory_uri() . '/js/tooltip.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'add_tooltip_js' );
then place tooltip.js file inside /js folder on your child theme. You do not need to copy header.php file to your child theme to enqueue that script :)
Best regards,
Yigit
Where do we get the tooltip.js file from?
Hi,
Since it’s from jquery ui, I don’t think it’s necessary to add an extra js file, try to replace this part of the code Yigit gave:
wp_enqueue_script( 'tooltip-js', get_template_directory_uri() . '/js/tooltip.js', array(), '1.0.0', true );
to
wp_enqueue_script( 'jquery-ui-tooltip' );
Hope this helps.
Best regards,
Nikko