最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

multisite - Homepage Menu Link Won't Function

programmeradmin2浏览0评论

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: /. Does anyone have any advice on how to get this menu item functioning correctly? Thanks in advance for your help.

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/staging/. Does anyone have any advice on how to get this menu item functioning correctly? Thanks in advance for your help.

Share Improve this question edited Jun 11, 2019 at 19:27 RiddleMeThis 3,8078 gold badges22 silver badges30 bronze badges asked Jun 11, 2019 at 15:54 Charles J. BarnettCharles J. Barnett 32 bronze badges 1
  • It is the menu link "Twin Tier Saves". I have narrowed it down to line #1985 in the jquery.js?ver=1.12.4-wp file. I am new to wordpress so any help that you can give is much appreciated. Thanks – Charles J. Barnett Commented Jun 11, 2019 at 18:46
Add a comment  | 

1 Answer 1

Reset to default 0

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.

发布评论

评论列表(0)

  1. 暂无评论