WordPress.org

Ready to get started?Download WordPress

Forums

Possible to include, not exclude, certain Pages? (8 posts)

  1. WPChina
    Member
    Posted 8 years ago #

    I have a bunch of pages I created, but I only want 3 or 4 to be displayed.

    I found that there is a way to exclude, with code like this:

    <?php wp_list_pages('exclude=57,58&title_li=') ?>

    But if I try to use "include" instead of "exclude", it doesn't work. Any idea if it is possible to only INCLUDE certain pages?

    tks!

  2. moshu
    Member
    Posted 8 years ago #

    You can use only the parameters listed in the Codex: Template_Tags/wp_list_pages

  3. WPChina
    Member
    Posted 8 years ago #

    :(

    I can hack the code to create an "include" feature, but when future upgrades to WP arrive I will always need to to tweak. If the developers are watching this thread, it would be great to have this feature in future versions.

    The reason this is important is that if you "include", you don't have to worry about adding more info to the tag in the future when you add more pages. However if you only use "exclude", each time you create a page you must remember to make changes to the code to exclude it (if you want) from being seen by users.

    tks! :)

  4. scillyman
    Member
    Posted 8 years ago #

    Very true.. good point.

  5. moshu
    Member
    Posted 8 years ago #

    Actually I agree with this logic, too. Unfortunately I am not a developer, just a volunteer helper in the forum.
    Let's hope somebody is watching this thread...

  6. petit
    Member
    Posted 8 years ago #

    You can try another approach.
    If you sort your links by category, such as "Blogroll", "Good Sites", "Whatever"..., you can do the following:'

    o Delete the wp_list_pages() section from your sidebar

    o In the Links/Link Categories add a new link category named "Pages"

    o Go to Manage/Pages and copy the permalinks for the pages you want to list.

    o Now go to Links/Manage and add the permalinks to the "Pages" link category.

    The links to your selected pages will show up in a separate list block in your links list.

    I've made an example for you at http://petitpub.com/blog.
    Far down at the right side under Blogroll and Friendly Sites, you find the Pages heading, with one link to my About page.

  7. WPChina
    Member
    Posted 8 years ago #

    Ahhh, very good suggestion petit! I woould still like to see an "include" addition to the native code in the future, but I will use your suggestion now, as it works pretty easily!

    Tks!!

  8. petit
    Member
    Posted 8 years ago #

    Shure, all software is refined under the pressure of its users ;)

Topic Closed

This topic has been closed to new replies.

About this Topic