WordPress.org

Support

Support » Plugins and Hacks » Creating a page which does not apear on my menu of pages.

Creating a page which does not apear on my menu of pages.

  • Hi there, I want to know how to create a completely secluded page from my list of pages (i have used this to create a nav menu) so that I may not mess up my menu of pages with a page that make no sense.

    Check this website: http://www.carrickashmead.com.au

    I am creating a contact page which will link to a “thank-you” page after an email has been sent to the recipient. It is the “thank-you” page which i want to be dynamic and be able to display such things as the name of the person, their email address and confirm that an email has reached the company and a reply will be sent shortly. I want this “thank-you” page to be a wordpress template page but not display with all the other pages.

    If you get me on this… let me know.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can exclude it from the page listing

    You need to use the exclude argument in the <?php wp_list_pages(); ?> tag to exclude that page by its numeric ID.

    http://codex.wordpress.org/Template_Tags/wp_list_pages
    gives the arguments for that tag.

    http://codex.wordpress.org/Template_Tags/How_to_Pass_Tag_Parameters
    explains how to pass parameters to the tag.

    Thanks works a treat.

    ‘<?php wp_list_pages(‘sort_column=ID&exclude=21′); ?>’

    my one is like this and I cant make it work 🙁
    /**
    * Function BX_get_pages
    * ------------------------------------------------------
    * Returns the following of all WP pages:
    * ID, title, name, (content)
    *
    * $withcontent specifies if the page's content will
    * also be returned
    */

    function BX_get_pages($with_content = '')
    {
    global $wpdb;
    $query = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_status='static' ORDER BY menu_order ASC";
    if ($with_content == "with_content") {
    $query = "SELECT ID, post_title,post_name, post_content FROM " . $wpdb->posts . " WHERE post_status='static' ORDER BY menu_order ASC";
    }
    return $wpdb->get_results($query);
    }

    /**
    * Function BX_excluded_pages()
    * ------------------------------------------------------
    * Returns the Blix default pages that are excluded
    * from the navigation in the sidebar
    *
    */

    function BX_excluded_pages()
    {
    $pages = BX_get_pages();
    $exclude = "";
    if ($pages) {
    foreach ($pages as $page) {
    $page_id = $page->ID;
    $page_name = $page->post_name;
    if ($page_name == "archives" || $page_name == "about" || $page_name == "about_short" || $page_name == "contact") {
    $exclude .= ", ".$page_id;
    }
    }
    $exclude = preg_replace("/^, (.*?)/","\\1",$exclude);
    }
    return $exclude;
    }

    I’m looking for exactly that, banana – if you find a fix, please post and let me know!

    What file can I find the wp_list_pages() in, this will solve my problem if I can find this in the code.

    Thanks,
    Clint

    In the file where your Pages are listed 🙂
    Most likely in the sidebar.php of your theme.
    It isn ‘t a wise idea to ask coding and display questions without a link or at least mentioning the theme you are using…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Creating a page which does not apear on my menu of pages.’ is closed to new replies.
Skip to toolbar