Support » Fixing WordPress » Problem with anchor link using a submenu: it will turn into a ‘#’

  • Hey there!

    I’m building this local site with a custom made theme for WordPress. First time using the platform so I’m still discovering somethings. 🙂

    While in a need to build a menu that works with the flow of this specific website, I’ve come to found a “problem”. I have this main page where I insert the whole content in sections, which section with it’s on particularity. One of them is like an ‘intro’ sort of so it would appear on mainpage with small explanations for each ‘sub-page’. This means there’s no real dettached main page, like:

    Home
    Content 1
    Content 2
      | Subcontent A
      | Subcontent B
      | Subcontent C
    Content 3
    Content 4
    Content 5

    This way, the menu would be something like this, where custom links appear within {curly brackets} and normal pages in [square]:

    <strong>Primary Menu</strong>
    Home ['home' page link]
    Content 1 {/#content1}
    Content 2 {/#content2}
     | Subcontent A ['subcontent A' page link]
     | Subcontent B ['subcontent B' page link]
     | Subcontent C ['subcontent C' page link]
    Content 3 {/#content3}
    Content 4 ['Content 4' page link]
    Content 5 {/#content5}

    However, whenever I try to build a button link “drawer” with a custom link as a parent and the childs as normal pages links, the /#content will turn into a single “#”. Which is a problem since I’m using anchors to add some smooth scroll and other events to this page.

    So, is there and workaround or such thing is taken as normal and there’s no solution?

    Any help will be much appreciated.

    P.S.: Sorry for any English mistakes. 🙂

    EDIT: fixing spaces due to indentation of examples being wrong

Viewing 2 replies - 1 through 2 (of 2 total)
  • JNashHawkins

    (@jnashhawkins)

    Read this article. Kinsta does a good job with this and they use the anchor links heavily on that article even.

    https://kinsta.com/blog/anchor-links/

    I will mention one more thing, I run the Classic Editor with Tiny MCE Advanced added and that has some helper extensions for anchors though I seldom use them.

    Thank you, @jnashhawkins. I’m going to read it right now.

    The Tiny MCE Advanced is a nice suggestion, altho my problem mainly happens on navbar tho. Got to think about it.

    EDIT: I red the article you suggested and got super confident on using anchors. I mean, even the cons weren’t that bad, since I’m aiming for user experience above page time. Altho it won’t solve my problem (as I listed above, which remains on navbar), it is indeed a very good read.

    I’m guessing I will try something like using only custom links. Somehow, I think wordpress won’t let me mix them (parent with dynamic page link and those static custom ones). Going to test it in this afternoon.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.