Codeless
  • Support Home
  • Themes
  • Support
  • WordPress Tutorials
    • How to Start a Blog
    • Best Website Builders
    • Best Small Business Hosting
    • Email Marketing Services
    • Cheap WordPress Hosting
  • Video Tutorials

Community Forums

Single Page Site Achors

    • 7 years, 9 months ago smi-steve
      Participant

      Expired

      I’m using the single page template, but I’ve got blog posts on the page. When you view one of the blog posts post, the top nav no longer functions since the links are in a format like #sec1. I attempted to change the links to include a / at the beginning (like /#sec1) but the smooth scrolling script doesn’t appear to like that and the nav stops functioning completely. Do you have a fix for this? Thanks!

    • 7 years, 9 months ago smi-steve
      Participant

      Expired

      I noticed something interesting which may help solve the problem. The links that have a / in front of them all have the current_page_item class on them on initial page load. Once you scroll down the page and something else picks up the current class, then all the links start working. That would make sense since the click handler ignores links when you are already on that section.

    • 7 years, 9 months ago smi-steve
      Participant

      Expired

      I spent some time looking at the jquery.onepage.js file  to figure out why those classes are being added and just finally realized they are being added server-side. If you view the source, any link that doesn’t start with a # in the nav gets the following classes added to it – current-menu-item current_page_item menu-item-home. Do you know why that would happen or what files generate the navigation?

    • 7 years, 9 months ago Ruco
      Keymaster

      Hello,

      If you have other pages except the onepage, you should add the link in the menu in this format: https://yoursiteurl.com/#sec1, jot just the section id ‘#sec1’.

      Try this and let us know.

      Best regards!

    • 7 years, 9 months ago smi-steve
      Participant

      Expired

      Unfortunately, that doesn’t work. Whether you use /#sec1 or https://sitename.com/#sec1, the link in the menu gets a current class added to it for some reason. That’s happening server side, so it has something to do with the code generating the menu.

    • 7 years, 9 months ago Mirela
      Participant

      Hello,

      Do you have enabled the “One page” option? Please go to your page’s General Settings > Page options & Style > Use menu as one page menu, set it ON if you plan to use the full feature one page layout. This means only id’s will be added at the menu.
      Or set it OFF, if you plan to keep the “https://sitename.com/#sec1” links in the menu.

      These related topics may help you find an answer:
      https://support.codeless.co/?topic=onepage-menu
      https://support.codeless.co/?topic=new-menu-on-interior-pages
      Let us know.

      Best regards!

    • 7 years, 9 months ago smi-steve
      Participant

      Expired

      If you turn it off the one page nav, the menu links still have the current classes, but now the smooth scrolling is disabled. What is generating the “current-menu-item current_page_item menu-item-home” classes? I’m assuming if we could get rid of that, then everything would work fine.

    • 7 years, 8 months ago Mirela
      Participant

      Hello,

      If all menu links are linking the same page, and the “One page” layout is not enabled, then ofcourse they will have the “current-menu-item” class enabled. Because all of them are pointing the current apge you are in.

      Please know that One Page is a different layout and by default you can not have both the normal set up (external pages) and One page (link to section id’s) in the same site.
      Smooth scrolling is a feature of One page. The moment you disable one page, that will go as well.

      The css classes are auto-generated based on the options you select. So it’s not possible to just get rid of some.
      Can you post some valid wp credentials in a private reply? So we can give it a closer look.

      Best regards!

    • 7 years, 8 months ago smi-steve
      Participant

      Expired

      This reply has been marked as private.
    • 7 years, 8 months ago smi-steve
      Participant

      Expired

      The main issue of the one page layout here is the addition of the current-menu-item class. It gets added for links like /#sec1 but not #sec1. I’m guessing that has something to do with the menu code for WordPress (in nav-menu-template.php) and may not be easily customized.

      This might be fixable if a different class is used in your main.js for the codelessOnePage function. I’m thinking that if current-menu-item was changed to something not already used by WordPress, then this problem would go away.

    • 7 years, 8 months ago smi-steve
      Participant

      Expired

      Also, I was able to get around this issue for now by commenting out an if statement in jquery.onepage.js. This was meant to prevent you from clicking on a section you were already on, but that was killing the nav on page load since all links had the current class.

      // if(!$parent.hasClass(self.config.currentClass)) {

      ….

      //}

    • 7 years, 8 months ago Mirela
      Participant
      This reply has been marked as private.
Viewing 11 reply threads

You must be logged in to reply to this topic.

Login

Log In
Register

Renew Support

  • Renew Specular Support
  • Renew Tower Support
  • Renew Folie Support
  • Renew Handel Support
  • Renew June Support
  • Renew Picante Support
  • Renew Thype Support
  • Renew Regn Support

Search Forums

Forums

  • Bygge – Construction Theme
  • Converta – Software Theme
  • Folie – The WordPress Website Builder
  • Handel – Responsive Multi-Purpose Business Theme
  • June WooCommerce WordPress Theme
  • Livecast – Podcast Theme
  • Picante – Restaurant & Food WordPress Theme
  • Regn | Agency & Business WordPress Theme
  • Remake – Minimal Portfolio & Agency Theme
  • Specular – Multi-Purpose WordPress Theme
  • Suggest us Features
  • Tower – Business-Driven Multipurpose WP Theme
  • Vibrance – Photography Theme

Site Links

  • Support Policy
  • Specular Support Forum
  • Video Tutorials
  • Knowledge Base
  • Guides and Reviews

Useful Articles

  • Build a Website
  • Web Design & Development
  • Hosting
  • WordPress

Login

Log In
Register Lost Password