Ask your WordPress questions! Pay money and get answers fast! (more info)

Find what's stopping links from working WordPress

  • SOLVED

The links in the header section above the navigation seem to have preventDefault() or something stopping them from working in two sections:

1. The top area above the navigation (inside the .navigation-button section) -screenshot: https://cl.ly/0n1B3t2b0Y1S

2. The images in the dropd-down menu under Services - when you hover they have the correct address but the link doesn't work.

Link: http://d38.d71.myftpupload.com/

Can anyone tell me how to either disable or over-ride whatever is stopping these links from working?

Answers (3)

2017-03-29

Rempty answers:

Hello
please need the webpage url to inspect the elements and find a solution


User162040 comments:

Updated with a link, thanks!


Rempty comments:

please try this
add this code to your functions.php
function custom_link_trigger(){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.navigation_button a').click(function(e){
e.preventDefault();
$href=jQuery(this).attr('href');
window.location=$href;
});
});
</script>
<?php
}
add_action('wp_footer','custom_link_trigger',99);


Rempty comments:

And for the images in the dropdown use the absolute URL
/services/oriental-area-rug-cleaning/
to
http://d38.d71.myftpupload.com/services/oriental-area-rug-cleaning/


User162040 comments:

Excellent! Thank you Rempty, those solutions both worked perfectly!

2017-03-29

Cesar Contreras answers:

2. The images in the dropd-down menu under Services - when you hover they have the correct address but the link doesn't work.

A: Try to add the absolute path as in the text


User162040 comments:

Well the absolute path solved the problem with the drop down!


Cesar Contreras comments:

Excellent, I'm working on the other problem

2017-03-29

Francisco Javier Carazo Gil answers:

Hi,

I have tried to use the absolute link and nothing happen (I have changed it in my browser inspector).

There is no JS problem... so it is like it is some kind of JS stopping it.

Really strange.

Anyway, add this to your JS and it will work again:

jQuery( 'div.col-sm-3 ul li.menu-item a').click( function(){ document.location.href=jQuery( this ).attr( 'href' ) } );


Francisco Javier Carazo Gil comments:

If you don't know how to include this JS in your code tell me and I tell you how to do it.