• urbanrich

    (@urbanrich)


    Hiya all

    I’m trying to change a menu link into an anchor link. I have a page called ‘Menu’ that I would like to have a drop down list with links that jump to certain parts of the page i.e ‘Burgers’. Then users can jump from another page directly to the linked area of the ‘Menu’ page.
    I’ve read a few different topics discussing how to do this, but seem unable to get it to work for me.
    Can anybody please give me any advice how I can achieve this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Which theme are you using?
    99,9% of all themes support menu_locations so you only need to fill it with pages\links\categories etc.
    First please follow this guide:
    http://codex.wordpress.org/WordPress_Menu_User_Guide

    If your theme does not support menus you need to add it to the theme first:
    http://codex.wordpress.org/Function_Reference/register_nav_menus
    http://codex.wordpress.org/Function_Reference/wp_nav_menu

    Moderator bcworkz

    (@bcworkz)

    The menu facility does not have the ability to automatically find element IDs for anchor links by default. You can always include such links by manually entering the links, but I suspect that is not your intention.

    To get the menu to automatically include anchor links, you should extend the Walker_Nav_Menu class to grab the content of each menu item (or just the menu page if that is your intent) and search for the element IDs that should be linked to, typically header elements. Once the IDs have been collected, it’s a simple matter of looping through them to generate a drop down form field for that page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to create anchor link for menu’ is closed to new replies.