How do I create page anchors from WordPress Menu's (8 posts)

  1. mosaicrob
    Posted 3 years ago #

    Is there a way to make a page anchor from a wordpress menu item?

    I'd like to add a custom anchor link to my wordpress main menu so that if the user clicks, it will jump to a certain part of the page.

    I tried adapting following the instructions below but it didn't work.


    <div id=”someword”>paragraph </div> went into the page...
    and then I created a custom link in the WP -> menu area that was http://mysite.com/pagename#someword

    But no luck. Can anybody help?

  2. viky081
    Posted 3 years ago #

    You can do it by the following steps,
    Go to admin panel of wordpress
    1)Click the Appearance->Menus in the left sidebar
    2)In the menu page click the Custom link in the left side
    3)By this you can add the url of the page that you need ....
    4)After finished click add menu option ....
    Hope its may help you

  3. mosaicrob
    Posted 3 years ago #

    Hi Vicky,

    Thanks for your fast reply but this is not what i'm asking. I know now to create a menu link, but I want to create a menu link that is also connected to a page anchor....

    The page I'm linking to is very long, so if people click the menu link, it would put them down the page in a certain area. Do you know how to do this??


  4. viky081
    Posted 3 years ago #

    If you have the menu like about us page means

    You may give a url of specified page that you need i.e.,
    In a custom Link

    url :http://www.google.com/
    Label : About us

    add menu

    On the right side of menu remove the about us page and place the custom page That you are created above...

  5. gecko_guy
    Posted 3 years ago #


    I have managed to create an anchor from a custom menu link...

    @viky081, you appear to have misunderstood the question.

    Back to the point, I have managed to use the custom url for making anchors to a post further down on the same page.

    All you need to do is add the post id to the custom menu item.

    Where it asks for the url, just type in the post ID --> #post-6329

    And give it a label.

    When the link is clicked, it takes one to that post on the same page.

    You don't need to use the post ID though. If you create an anchor on the page wherever you want, eg a post about how to make pickled onions:

    <a href="#pickled-onions">Pickled Onions</a>

    Then just insert #pickled-onions into the custom url field for the menu on that page. When you click the custom menu link it will jump to the anchor.

    However, what I'd really like to do is add a scroll event, so that when clicked the page scrolls to the anchor, instead of jumping straight there. I can do this easily with ordinary links, but having problems getting it to work with WP menu links as anchor links.

  6. oicolague
    Posted 3 years ago #

    Thanks gecko-guy!

  7. oicolague
    Posted 3 years ago #

    Do you have an example of a wordpress menu that does this?

  8. tdkehoe
    Posted 2 years ago #

    In HTML this is called a document fragment.

    There are two steps. First you insert an anchor in your webpage:

    <a name="smalltalk-reviews"><h2>Reviews</h2></a>

    Then in Appearance > Menus, in the Custom Links box you put in the URL plus a pound sign plus the fragment name:


    Then you can put the menu item anywhere in your menus.

Topic Closed

This topic has been closed to new replies.

About this Topic