Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

How to use anchor links from theme settings?

  • #9203
    Avatar photo[anonymous]

    That is, I would like to mark text in a post as anchor and link to this position it from text in the theme settings.

    #9290
    Avatar photo[anonymous]

    Hi! What do you mean by linking to the anchor in the theme settings?

    Typically, to create an anchor, you would add an ID to the markup of the text. Here’s an example for the webpage http://www.mysite.com/page:

    <p>This is my text. Here's my <span id="the-id">anchor</span>. Hope you like it!</p>

    Then, to create an anchor link, you would add a reference to that webpage, follow by a slash, # and the ID:

    <p>Here is my anchor. Hope it works!</p>
    #9327
    Avatar photo[anonymous]

    I mean a link from the frontpage’s hero section to a certain position on a certain page, namely a certain meal with a h4 heading.

    With your method, this is what I get:

    • 16 – YAKI-TORI
      4,50 €
      2 STK – Japanische Hühnchenspieße mit Teriyaki Sauce
    • anchor class=”uKXCDd”>17 – Satay Gay
      4,50 €
      2 STK – Thailändische Hühnchenspieße mit Erdnuss Sauce
    #9329
    Avatar photo[anonymous]

    You need to use an ID inside your H4, not a class. Anchors only work with IDs.

    #9331
    Avatar photo[anonymous]

    The anchor class has the same identifier than the headings’ and got created automatically upon saving, maybe due to the span tag.

    I tried without span tag and now it works:

    <h4 id=”satay-gay” class=”uKXCDd”>17 – Satay Gay</h4>

    Thanks for your help!

    #9336
    Avatar photo[anonymous]

    Yes, I should have specified: the ID should be added to whatever HTML tag you want to reference to. Could be a p tag, a heading, a div, etc.