Support » Themes and Templates » Linking to pages as nav links w/o using the page name

  • Resolved krimsly

    (@krimsly)


    Greetings all,

    I’m building a theme that uses the pages as navigation links. I’d like the end user to be able to change the names of the pages w/o the nav links breaking. Each nav link is uniquely styled rather than lending itself to uniform

    • ‘s, so I didn’t use wp_list_pages().
    • My solution to this was to figure out the ID of the pages and retrieve the page links using their ID’s, then link to those ID’s directly in my theme. That works great, as long as the end user doesn’t delete the page 🙂

      But, I’m wondering if someone has a better solution to this?

      Thanks

      NorthK

Viewing 3 replies - 1 through 3 (of 3 total)
  • Add a custom field to the relevant pages (something like key:main_nav / value: yes)?

    Thread Starter krimsly

    (@krimsly)

    Hmmm, so the custom field (let’s call it “Primary Key”) for a given page (for example “Contact Us”), would always have the same value, such as “ContactUsUniqueKey”. Then I would traverse the list of pages looking for whatever page has that custom field value “ContactUsUniqueKey”.

    That way the end user could change the name of the page to “Get In Touch” but it would still have the custom field with value of “ContactUsUniqueKey” which I would look for and know that page is the right one to link to. Is this what you suggest? If so, that might work.

    The advantage of what you suggest is even if they deleted the page by accident, they could re-create it with that custom key/value and it would get linked to properly even though the page ID would be different….good call. Please let me know if I’m understanding you right.

    Thanks

    NorthK

    That’s exactly what I meant. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Linking to pages as nav links w/o using the page name’ is closed to new replies.