I am fairly new to Wordpress. I have been setting up sites using a template in a multisite installation. On the home page, one of the links "Twin Tiers Saves" is unresponsive but it shows in the bottom left corner of the page without the "http://" necessary for navigation. The link should open a new tab but when I click it nothing happens. The link works on all other pages except the homepage. The site is here: https://capcityradio.net/staging/. Does anyone have any advice on how to get this menu item functioning correctly? Thanks in advance for your help.
1 Answer
This function in /themes/lucid-press-child/js/custom-js.js
is your problem.
function homepageNavigationClasses(){
if(jQuery('body.home').length){
//jQuery('#navigation a').not('.sub-menu a').click(function(event){
jQuery('#navigation a').click(function(event){
var clickedLink = jQuery(this).text();
clickedLink = clickedLink.replace(/\s/g,'');
if(!jQuery(this).parent().hasClass('page')){
event.preventDefault();
//console.log(clickedLink);
jQuery('html, body').animate({
scrollTop: jQuery("#"+clickedLink).offset().top - 400
}, 500);
jQuery('#navigation li').removeClass('active-hp-section');
jQuery(this).parent().addClass('active-hp-section');
}
});
}
}
It's looking for a ID to scroll the page too but it doesn't have one because its an external link.
You could create a child theme and re-write the function. But the following solution is probably simpler.
Go to Admin > Appearance > Customize > Menus
and manually add the page
class to the "CSS Classes" field. This will add the class to the list item of the link and now your link will function as normal.
-
Thank you so much....I am very new to this so please forgive me as I am attempting to move into wordpress/web dev from mostly c# and python. Following your instructions, I get to the menu area but I am not sure how to add a class. Can you please explain more? Jun 11, 2019 at 19:39
-
Did you add the "Twin Tiers Saves" link in through the customizer menu? If so you should be able to add a class. See the image I added to my answer. If you didn't add the link that way, how did you add it? Jun 11, 2019 at 19:46
-
Thank you so much!!! I wish I could see you in person and hand you money in your hand. You just saved my life. Good karma will definitely be returned your way. Thank you again Jun 11, 2019 at 19:49