• I have a problem, about listing up the pages with template tags.

    I know how to “exclude” certain IDs not listed, as the codex explains, however, there seems to be no explanation on showing only desired Page IDs to be listed.

    I tried this…but didn’t work at all.

    ‘<?php wp_list_pages(‘ID=32,33,34,36,37,35,38&title_li’); ?>’

    Is there any code hack available to solve this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator James Huff

    (@macmanx)

    Thread Starter takuya

    (@takuya)

    macmanx, we all know the links to the codex…

    Anyone kind enough to solve this question?

    I personally wonder…if “exclude” parameter is available, why not “include”? Will this be solved with future release of WP?

    Moderator James Huff

    (@macmanx)

    Anyone kind enough to read what the “links to the codex” link to?

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

    There is no “include” parameter, only “exclude”.

    Thread Starter takuya

    (@takuya)

    oh, I may have found…but let’s see…

    Everytime I look at the codex, I always think developers of WP is way too genious. I mean, how could you guys come up with these original codes!?!?

    Thread Starter takuya

    (@takuya)

    Anyone kind enough to read what the “links to the codex” link to?

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

    Well, no one here asks about excluding the IDs mac. It’s about including certain page IDs, and is a bit different from excluding…as it really is a tough work if you have plenty of pages like 30-40, and you only want to show a few of them.

    Moderator James Huff

    (@macmanx)

    It’s tough work that you only have to do once, and then one more time whenever you create a page that you want to include.

    Moderator James Huff

    (@macmanx)

    If it really is too much trouble, you can always create a generic coded links list in the side bar. Ex:
    <li><h2><?php _e('Menu Title'); ?></h2>
    <ul>
    <li><a href="http://www.domain1.com/site1/">Site1 Title</a></li>
    <li><a href="http://www.domain.com/site2/">Site2 Title</a></li>
    </ul>
    </li>

    Thread Starter takuya

    (@takuya)

    That standard HTML is the best for non php coders, for sure, but I’d like to know how to solve this with the codes, not only with HTML.

    I’ve just tried,

    <?php wp_list_pages('sort_column=32,33,34,36,37,35,38&title_li'); ?>

    then I got this error, although I have the page 32 availabe on my site.

    WordPress database error: [Unknown column ’32’ in ‘order clause’]
    SELECT ID, post_title,post_parent ,UNIX_TIMESTAMP(post_modified) AS time_modified,UNIX_TIMESTAMP(post_date) AS time_created FROM en_posts WHERE post_status = ‘static’ ORDER BY 32,33,34,36,37,35,38 ASC

    I also added ID b/w sort_column and numeric numbers, but it didn’t work at all.

    Moderator James Huff

    (@macmanx)

    You’re probably thinking of sort_column=ID . It can only be used as sort_column=ID , which sorts the Pages column by Page ID. Unfortunately, your only options are either using exclude, hard-coding a list, or writing a plugin: http://codex.wordpress.org/Writing_a_Plugin

    Thread Starter takuya

    (@takuya)

    I added “child_of” to exclude other pages, then it showed the contents I only wanted to show. However, the pages were arranged by alphabetically, ignoring the command written within php code. I just feel it’s pity, since it got closer to what I wanted. 😉

    This is probably my 4th day, playing around with php code, so “Writing a Plugin” is something impossible, unless, there’s some auto php generator which can generate codes for WordPress.

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

The topic ‘Make certain page IDs ONLY to show up’ is closed to new replies.