Forums

Remove Sub-Pages from "pages" (7 posts)

  1. francisck
    Member
    Posted 3 years ago #

    I don't want "sub-pages" to be displayed in the "pages" Bar. There are way to many (one of every letter)

    Is there any way to do that?

    sorry for the short topic!

    Best Regards,
    Francisck

  2. equaldesign
    Member
    Posted 3 years ago #

    Edit your <?php wp_list_pages(); ?> code so that you include the depth=1 function.

    http://codex.wordpress.org/Template_Tags/wp_list_pages#Parameters

  3. francisck
    Member
    Posted 3 years ago #

    This topic says it has two reply's but I only see mine, any help?

  4. equaldesign
    Member
    Posted 3 years ago #

    Yes I replied but for some reason it has disappeared?

    Add the depth parameter to the wp_list_pages() tag. Depth=1 will only show the main parent pages.

    http://codex.wordpress.org/Template_Tags/wp_list_pages#Parameters

  5. francisck
    Member
    Posted 3 years ago #

    Thanks but I can't find wp_list_Pages in the sidebar.php I have the Itheme theme running and I can't seem to find it, any help?

  6. equaldesign
    Member
    Posted 3 years ago #

    Will need to see your sidebar code in order to help on this one.

  7. martzee05
    Member
    Posted 2 years ago #

    francisck, the wp_list_pages function is in post-template.php file located in wp-includes folder on your server. I am not sure you can edit it via editor in your admin, but what I did is to go to your server, locate wp-includes folder, download the original file post-template.php and save it as a copy, which you would edit, while still having your original file intact for the case something goes wrong. Approx. on the line #303 (if you use any editor with rulers indicating number of lines and columns) or about in the middle of the file you would find the following function:

    function wp_list_pages($args = '') {
    $defaults = array(
    'depth' => 0, 'show_date' => '',
    'date_format' => get_option('date_format'),
    'child_of' => 0, 'exclude' => '',
    'title_li' => __('Pages'), 'echo' => 1,
    'authors' => '', 'sort_column' => 'menu_order, post_title'
    );

    here you can change the depth, exclude certain pages from listing or whatever you want. Save it and upload it back up to your server. Everything should work properly then.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.