Skip to:
Content
Pages
Categories
Search
Top
Bottom

Unable to exclude page from navigation

  • Avatar of absticles
    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)
  • Avatar of absticles
    absticles
    Participant

    @absticles

    Can anyone help with this? Thanks. Abi

    Avatar of r-a-y
    r-a-y
    Moderator

    @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' );

    Avatar of absticles
    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

    Avatar of @mercime
    @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?

    Avatar of absticles
    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!

    Avatar of r-a-y
    r-a-y
    Moderator

    @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.

    Avatar of absticles
    absticles
    Participant

    @absticles

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

    Still doesn’t hide!

    Avatar of absticles
    absticles
    Participant

    @absticles

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

    Avatar of Boone Gorges
    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?

    Avatar of absticles
    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

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

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

    Avatar of absticles
    absticles
    Participant

    @absticles

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

    Avatar of Arx Poetica
    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?

    Avatar of r-a-y
    r-a-y
    Moderator

    @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.

    Avatar of Arx Poetica
    Arx Poetica
    Participant

    @arxpoetica

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

    Avatar of Arx Poetica
    Arx Poetica
    Participant

    @arxpoetica

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

    Again, thanks for the help!

    Avatar of kizinko
    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:
    `

  • Example Page 1
  • Example Page 2
  • `

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

    Hope this helps!

    Brandon~

    http://allmywebneeds.com

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

You must be logged in to reply to this topic.