WordPress.org

Ready to get started?Download WordPress

Forums

changing order of pages in list of pages (3 posts)

  1. niros
    Member
    Posted 2 years ago #

    hi everybody.
    i'm not a skillful code writer, but i imagine what i want is possible to do, and i hope someone knows how to help me.
    i have a page in my website that shows a list of all of the pages in it. the code in it's center goes like this:

    <h2><?php _e('Pages', 'hemingway'); ?></h2>
    <ul class="pages">
    <?php wp_list_pages('title_li='); ?>
    </ul>

    here’s a link [it’s in Hebrew]:
    http://ms.somethingperverted.com/links/

    here is what i want:
    1. currently the list shows pages according to their order number, and i want to reverse the list. i want it to show newest pages, or pages with a larger number first, and older pages, or pages with a smaller number last.
    2. currently the list shows all of my pages in the same list, and i want it to split the list to different pages. i want it to show only 15 pages at a time, and a "previous / next" button in the bottom, for lists of older or newer pages.

    if anyone knows how to do it, i'll be very thankful.
    thankS
    :-]

  2. rachelbaker
    Member
    Posted 2 years ago #

    The wp_list_pages function information is covered in the Codex here: http://codex.wordpress.org/Function_Reference/wp_list_pages

    You can modify your code to
    <?php wp_list_pages('sort_order=DESC&number=15&title_li='); ?>

    That will display the pages in the opposite order and only display 15 of them, however I recommend using the WP Query function where you can page the results into increments of 15 as you desire. http://codex.wordpress.org/Class_Reference/WP_Query#Interacting_with_WP_Query

  3. niros
    Member
    Posted 2 years ago #

    thank you very much!
    it's so fun to learn new things :-]

    here's the new problem:
    now the list shows only 15 pages, and i want to have in the bottom a link to the previous 15 pages, and there to have a link to the previous or next list etc.
    somewhat like the list i have as an admin in my control pannel.

    how can that be done?
    thanks :-]

Topic Closed

This topic has been closed to new replies.

About this Topic