Ready to get started?Download WordPress


I want only my sub-pages to be clickable in the navbar (5 posts)

  1. heyheyhey
    Posted 1 year ago #

    I am building a simple website with a number of pages, each of which is grouped.

    Let's say my website has roughly 20 pages, grouped into 5 categories. So I want my navbar to display the 5 categories, and each category, on rollover, displays the pages created under it.

    Now since I am creating my pages as pages and not posts, I understand that "categories" are not available. So I am creating them as sub-pages. And I am creating each "category" as a page.

    My problem: I only created these "pages" for the purpose of grouping the "sub-pages" in the navbar. But none of these "pages" are actual pages, so I don't want any of them to be clickable. What I want is if someone clicks on the "page" itself in the navbar, they should be taken to the first sub-page of that category (or page).

    I would be grateful for any solutions.

    (Side note: This seems like an extremely common situation, and yet, after hunting around for quite a while, I see nothing addressing the issue. I'm a web programmer with over a decade experience, but a relative newbie to wp, and I find this kind of situation repeating itself over and over.)

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Create a custom menu - then use the "Custom Links" to add the top level nav items - once it's in the menu, you can remove the URL (click on the flippy triangle on the menu item to modify that item.

  3. heyheyhey
    Posted 1 year ago #

    Thank you, WPyogi. I have created the Custom Menu. But I do not see how to implement the following part of your post:

    once it's in the menu, you can remove the URL

    When I click on any item that I have added to the menu, the only things I see that I have control over are: (a) Navigation Label and (b) Title Attribute, but not URL.

    And I wish to clarify: I do not wish to remove the URL altogether -- what I want is that clicking on the parent will be equivalent to clicking on the first child.

  4. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Did you use the "Custom Links" (box under the Theme Locations box) to create the menu item (not an actual page)? In those types of items, you will have a URL field.

  5. heyheyhey
    Posted 1 year ago #

    You are right, WPyogi. I did not read your first post carefully enough. Your solution accomplishes what I need. Thank you.

    I think however that even better would be if WordPress would allow Page Categories, that would automatically create such groupings in the menu. Does that make sense to you?

Topic Closed

This topic has been closed to new replies.

About this Topic