Forums

Page not in menu (11 posts)

  1. GF1945
    Member
    Posted 6 months ago #

    Hello,

    I got a small problem. A couple of pages I created I don't want to have in my menu. I've tried to do this with a couple of plugins, like Exclude Pages from Navigation and Page Link Manager. But this doesn't do the job. When I try to do it with these plugins the pages that I try to hide aren't accessible for visitors. And that's not what I want.

    Does someone has a solution?

    A link to the website: Link. The page where I tried these plugins is this one. The last three links on this page (at the bottom) are pages that I don't want in the menu, but they must be accessible for the public.

  2. SwansonPhotos
    Member
    Posted 6 months ago #

    It can be done by adding a filter
    You will have to review where pages are queried in your theme and apply the change manually if your theme does not support this filter in the theme settings.

  3. Jonas Grumby
    Member
    Posted 6 months ago #

    I'm confused about what you mean by "pages that I don't want in the menu, but they must be accessible for the public".

    You may want to check out the User Access Manager plugin. It will hide pages from the menu and protect them from view unless the user is logged in and has permission to see them.

    Another option would be to use a Custom Menu under Appearance. If your theme is old and does not support custom menus it's not that hard to add that.

    If you are handy with code you may also be able to exclude the page links from your menu.

    http://wordpress.org/search/exclude+page

  4. GF1945
    Member
    Posted 6 months ago #

    @SwansonPhotos: I saw this solution earlier today. I couldn't find 'wp_list_pages', so I have to search for it. But I will try it tomorrow.

    @Jonas Grumby: I want those pages only accessible through a link on the page I mentioned in my first post. Hope I explain it good for you now.

  5. Jonas Grumby
    Member
    Posted 6 months ago #

    A Custom Menu would probably be easiest if your theme supports it.

  6. GF1945
    Member
    Posted 6 months ago #

    I found this:

    <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
        <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>

    Guess this is the right one. I tried to put in the code, like this:

    <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ) ('exclude=17,38' ); ?>

    [Please post code snippets between backticks or use the code button.]

    But it messed up the entire website. I guess I did something wrong.

  7. GF1945
    Member
    Posted 6 months ago #

    @Jonas: If this doesn't work I am going for that!

  8. SwansonPhotos
    Member
    Posted 6 months ago #

    wp_list_pages is a query on the DB that retrievs the page id's, by adding the filter those page id's will not be loaded later into the menu. Same effect as an category or tag with 0 posts.

  9. Jonas Grumby
    Member
    Posted 6 months ago #

    If your theme supports custom menus in that location you don't need to worry about that code. Check your appearance options to see if your theme supports custom menus.

  10. SwansonPhotos
    Member
    Posted 6 months ago #

    And yes, if you use a theme that supports custom menus, that is certainly a way to go. Of course, they also need to be updated with new top level content (but not if you add sub's and a good menu level theme)...if you have many items on a regular interval, this could be burdomesome, Custom Menus are used best for a nav menu of the best pages or post or tags, content, etc., all in in one menu - your good stuff!

  11. GF1945
    Member
    Posted 6 months ago #

    ('exclude=17,38' ) doesn't work so far. Can someone tell me where to put that piece of code in this piece: <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>

    The theme I use is Simpleblue (created by zp1214): http://wordpress.org/extend/themes/simpleblue

Reply

You must log in to post.

About this Topic

Tags