WordPress.org

Ready to get started?Download WordPress

Forums

Anchor tags in text widget not working (17 posts)

  1. studio544
    Member
    Posted 9 months ago #

    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.

  2. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

    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).

  3. studio544
    Member
    Posted 9 months ago #

    Here's an example:

    In the text widget:
    <a href="http://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>

  4. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

    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>
  5. studio544
    Member
    Posted 9 months ago #

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

  6. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

    Where is the page?

  7. studio544
    Member
    Posted 9 months ago #

    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.

  8. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

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

  9. studio544
    Member
    Posted 9 months ago #

    Sorry. Here you go.

    http://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 http://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>

  10. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

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

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

    vs.

    http://hairlosssolutionsnow.com/faqs/#started/
  11. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

    IS that a permalink issue?

  12. studio544
    Member
    Posted 9 months ago #

    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.

  13. studio544
    Member
    Posted 9 months ago #

    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.

  14. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

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

    Put this in your browser:

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

    It gets changed to:

    http://hairlosssolutionsnow.com/faqs/#started/
  15. studio544
    Member
    Posted 9 months ago #

    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.

  16. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

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

  17. studio544
    Member
    Posted 9 months ago #

    Thanks for the suggestions. I'll see what I can do but there are a lot of plugins installed. It could be like finding a needle in a haystack. I will try some more experimenting.

Reply

You must log in to post.

About this Topic

Tags