• I’m trying to create some basic text bullet points within a text widget using <li> and anchor tags. While the links are going to the correct page on the site, they are not going to the anchors placed on the page. The coding is correct. Is this just not possible to do with the text widget? I did not see anything on the forum specifically about this.

Viewing 15 replies - 1 through 15 (of 16 total)
  • What code are you using?

    Also note that you must put code inside code tags here – otherwise li tags break the formatting of these forums (fixed yours).

    Thread Starter studio544

    (@studio544)

    Here’s an example:

    In the text widget:
    <a href="https://mysite.com/faqs#started/"><li>How do I get started?</a></li>

    And on the page I want it to go to:
    <h3><span style="color: #79B7D0;"><a name="started">How do I get started?</a></span></h3>

    name is deprecated – try using id instead.

    It should also go in the h3 tags – you don’t use anchors on that end – so:

    <h3 id="started"><span style="color: #79B7D0;">How do I get started?</span></h3>

    Thread Starter studio544

    (@studio544)

    Thanks for the suggestion but it still didn’t work. It just goes to the correct page but is completely ignoring the anchor.

    Where is the page?

    Thread Starter studio544

    (@studio544)

    It’s just a regular WordPress page contained on the same site as the text widget. The text widget would be visible on all pages of the site so the bulleted links would always be visible to a site visitor.

    I meant could you post a link to the site so I can look at what’s going on.

    Thread Starter studio544

    (@studio544)

    Sorry. Here you go.

    https://hairlosssolutionsnow.com

    You’ll see the 3 bulleted text links in the right sidebar under FAQ’s. The third one should be anchored to the bottom of the FAQ page at https://hairlosssolutionsnow.com/faqs/#started/.

    There will be more links added but I wanted to make sure it worked before spending more time on this. Thanks.

    Once again here is the code I used on the FAQ page for the anchor:
    <h3 id="started"><span style="color: #79B7D0;">How do I get started?</span></h3>

    Looks like your link has a different URL than where the page really is?

    <a href="https://hairlosssolutionsnow.com/about-hairloss-solutions/faqs#started/">

    vs.

    https://hairlosssolutionsnow.com/faqs/#started/

    IS that a permalink issue?

    Thread Starter studio544

    (@studio544)

    That’s interesting. I’m not sure how the “about-hairloss-solutiions” got in the URL but I have removed it from the link and they are still not working.

    Permalinks are set to /%category%/%postname%/

    Could that have something to do with it? I just changed the Permalinks on the site about 2 weeks ago but this FAQ page was just added to the menu today.

    Thread Starter studio544

    (@studio544)

    Ok, I ran some more tests on this and put the <li>links on the same page as the anchor tags to see if they would work. The one with the <a name="contracts">worked.

    The one using id in the H1 tag did not. It’s interesting…

    Anyway, nothing seems to work when linking to the anchors from outside the actual page like I wanted to do with the text widget.

    Something is changing the URL when you try to go the linked URL –

    Put this in your browser:

    https://hairlosssolutionsnow.com/faqs#started/

    It gets changed to:

    https://hairlosssolutionsnow.com/faqs/#started/

    Thread Starter studio544

    (@studio544)

    Yes, I noticed the same thing. I tried changing the permalinks structure and it did the same thing… I may just end up creating a separate post for each FAQ and link to them from the text widget that way. At least that seems to work. There must be something within the text widget structure or theme that is changing the URL.

    You could try deactivating your plugins to see if any are adding the slash.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Anchor tags in text widget not working’ is closed to new replies.