[resolved] Help with PHP to exclude a page (4 posts)

  1. shlinklincoln
    Posted 8 years ago #

    I want to exlude page number 70 but not sure how to edit the following code in my Header:

    <?php wp_list_pages('title_li=&depth=1&'.$page_sort.'&'.$pages_to_exclude)?>

    Do I add 70 after "pages_to_exclude"? My attempts to play with the code result in errors. I'm still learning PHP.

    Thanks for any help.

  2. MichaelH
    Posted 8 years ago #

    The $pages_to_exclude is a variable that might be reference somewhere else in your code (as is $page_sort).

    Might want to paste your whole template (header.php) at http://wordpress.pastebin.ca/ and report the link back here.

    If not, review wp_list_pages().

  3. Jeremy Clark
    Posted 8 years ago #

    It should look like this
    <?php wp_list_pages('title_li=&depth=1&page_sort=asc&exclude=1')?>

    Where exclude=1 the 1 equals the page ID/s you'd like to exclude.

    Further Reference

  4. shlinklincoln
    Posted 8 years ago #

    That worked!

    Thank you very much.

Topic Closed

This topic has been closed to new replies.

About this Topic