WordPress.org

Ready to get started?Download WordPress

Forums

Navigating to a specific spot on a page in WP (7 posts)

  1. IBIT
    Member
    Posted 1 year ago #

    I'm using the Twenty Twelve theme and have some extremely long pages. I'd like to create hyperlinks that enable a reader to jump to specific spots on the page. I used to be able to do this on my old, defunct Web site, but can't seem to do it in WP. Have tried the old HTML tricks a name and a id -- and yes, I did include the hashtag at the anchor point, but nothing works. Is there a way to this that I haven't tried yet, or is it just something that WP won't allow?

    Thanks.

  2. Andrew Bartel
    Member
    Posted 1 year ago #

    Anchor tags works fine, I've done it on countless WordPress sites.

    Example:

    <a href="#anchor1">Anchor 1</a>
    <a href="#anchor2">Anchor 2</a>
    
    // lots of text
    
    <div id="anchor1">
    // some div content
    </div>
    
    // lots more text
    
    <div id="anchor2">
    // some div content
    </div>
  3. Aaron
    Member
    Posted 1 year ago #

    Also just an FYI using <a name="whatever"> is outdated and you should do it like the example above.

  4. IBIT
    Member
    Posted 1 year ago #

    Thanks, guys. QUESTION: Do I need to include the entire URL in the anchor tag, or can I get away with just the name of the anchor?

  5. Aaron
    Member
    Posted 1 year ago #

    Just like the example above. Not the entire URL.

  6. IBIT
    Member
    Posted 1 year ago #

    It works...PERFECTLY! Many thanks to you both!

  7. IBIT
    Member
    Posted 1 year ago #

    Okay, next question: Now that readers can skip section-by-section at will, I need to create a "BACK to TOP" link. If a name and a id are deprecated, how do I do that?

Topic Closed

This topic has been closed to new replies.

About this Topic