Skip to:
Content
Pages
Categories
Search
Top
Bottom

Unable to exclude page from navigation


  • absticles
    Participant

    @absticles

    Hey there.

    I can’t seem to exclude certain pages from the main navigation. The links are listed using the wp_list_pages template tag and the parameters are ‘title_li=&depth=1&exclude=14’.

    14 being the page ID of the page I wish to exclude. For some reason it’s still sitting in the navigation.

    I’ve also tried excluding it using the page widget in the Appearance settings.

    Hope someone can help!

    Thanks,
    Abi

Viewing 17 replies - 1 through 17 (of 17 total)

  • absticles
    Participant

    @absticles

    Can anyone help with this? Thanks. Abi


    r-a-y
    Keymaster

    @r-a-y

    If you’re using a child theme, simply edit header.php and modify the wp_list_pages() line with:

    wp_list_pages( 'exclude=14' );


    absticles
    Participant

    @absticles

    I did actually try this and it still doesn’t hide it! And I tried it in the page widget in the Appearance settings!

    Hope you can help. Thanks. Abi


    @mercime
    Keymaster

    @mercime

    What @r-a-y gave you works for me in bp-default child theme. What theme are you using? Do you have any plugin relating to navigation or pages installed in your WP?


    absticles
    Participant

    @absticles

    Yep I’m using a child theme. It’s bizarre that it doesn’t work.

    I have the following plugins activated:
    ‘Buddypress’
    ‘Remove BuddyPress Admin Bar’

    They’re the only ones activated!


    r-a-y
    Keymaster

    @r-a-y

    Make sure that you’re referencing the right page ID? Also try other page IDs to see if wp_list_pages() is actually working.


    absticles
    Participant

    @absticles

    Tried hiding a page with a different ID using:
    title_li=&depth=1&exclude=2

    Still doesn’t hide!


    absticles
    Participant

    @absticles

    Does any one have any ideas? Driving me nuts! Thanks, Abi


    Boone Gorges
    Keymaster

    @boonebgorges

    The code that people are giving should work. The only way we could test any further is if you posted the code you’re trying to use in context. Are you using a common theme, or one you developed yourself? If the latter, can you put the contents of header.php into a pastebin so others can test it?


    absticles
    Participant

    @absticles

    I am creating a buddypress child theme.

    http://tinypaste.com/64e4b

    wp_list_pages should be on line 91. All of that code is within my header.php file.

    Thanks,
    Abi


    r-a-y
    Keymaster

    @r-a-y

    You have to add a comma, see below:
    exclude=2,'. bp_dtheme_page_on_front()


    absticles
    Participant

    @absticles

    Ah. As simple as that! Genius. Thanks r-a-y!


    Arx Poetica
    Participant

    @arxpoetica

    Adding to this thread (maybe I should start a new?)…suppose I didn’t want to edit header.php in any way shape or form. Is there any way to suppress certain pages from a functions.php page…

    …further what I might actually want to do is suppress *all* wp_list_pages() and just keep the native BuddyPress ones. Hmm…any thoughts?


    r-a-y
    Keymaster

    @r-a-y

    @arxpoetica – That’s possible via the “wp_list_pages_excludes” filter.

    You’ll need to return an array of page IDs you want to exclude.

    Example code:
    http://pastebin.com/HUyVsWSN

    Change 1,2,3 to page ids you want to omit.


    Arx Poetica
    Participant

    @arxpoetica

    Thanks @r-a-y — always to the rescue! I’ll let you know if it works. :D


    Arx Poetica
    Participant

    @arxpoetica

    Here’s what worked for me: http://pastebin.com/WLMckWV6

    Again, thanks for the help!


    kizinko
    Participant

    @kizinko

    This fix may not work for you, but what I did was I changed the header.php file by commenting out the following line (it was line 79 for me) like so:

    
    
    

    Then I manually added new links to my pages:

    
    <li><a href="http://yourwebsite.com/your-first-page/" title='Example Page 1'>Example Page 1</a></li>
    <li><a href="http://yourwebsite.com/your-second-page/" title='Example Page 2'>Example Page 2</a></li>
    

    It may not be the best way for you, but it definitely works.

    Hope this helps!

    Brandon~

    Home

Viewing 17 replies - 1 through 17 (of 17 total)
  • The topic ‘Unable to exclude page from navigation’ is closed to new replies.
Skip to toolbar