Everything was working fine. I never changed a line of code, but site is behaving unusually instead of opening that pop now it is creating an undefined URL. I was struggling from 3-4 hours reading every line of code that I have written. Can you please guide me what steps should I take and where should I look forward to further troubleshoot this?
You must have changed something?
Where is your custom js file It doesnât seem to be in the directory that you are pointing to:
Probably not related to this issue but you havenât tidied up the errors I pointed out before in previous posts as there are still errors showing for them in the web console.
Sorry for diving in the discussion.
Normally people work on the child theme. It should be here. i checked and its in child theme â
No worries
Thatâs not what I was looking for anyway so Iâll have to go and have another look
Using a child theme is a very good idea. But it looks as though the child themeâs function.php file is empty. Donât you need to âenqueueâ for things to work?
Hi there,
it is already there in child themes functions.php =
function enqueing_scripts() {
wp_register_script('my_amazing_script', get_template_directory_uri() . '/js/custom.js', array('jquery'),'1.1', true);
wp_enqueue_script('my_amazing_script');
}
add_action( 'wp_enqueue_scripts', 'enqueing_scripts', 999 );
I think the issue is that you have now added full urls to your anchor links and previously you just had the fragment identifier in the anchor url.
You only want to jump to the target pop up not to a new page with a popup.
You have this:
<a href="http://www.xxxxxxxxxxxxxxxxxx.co.uk/#target-content">
When you just want this:
<a href="#target-content">
I suppose you could just hard code the JS instead.
e.g.
Do this:
<script>
(function($) {
$('#menu-footer-menu li:last-child a,#menu-footer-menu li:last-child').removeClass('menu-item');
$(document).ready(function(){
//var href = $('#menu-footer-menu a[href="#target-content"]' ).attr('href');
// assumes you always have a popup with an id of target-content
var href = "#target-content";
setTimeout(
function()
{
window.location.href = href;
}, 5000);
});
})(jQuery);
</script>
Of course you probably should check that the id exists first or you will get the 404 like last time if you ever change the id.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.