0

Is there anyway of showing the 2 first pages in one <ul> and the last 2 pages in another <ul> in WordPress?

On my page I have two different lists for the navigation bar:

<ul>
   <li>One</li>
   <li>Two</li>
</ul>

and

<ul>
   <li>Three</li>
   <li>Four</li>
</ul>

Limit the data wp_list_pages() gets by 2 and the first one should show ASC and last one DESC - something like that...

4

1 回答 1

2

Try this

<ul>
<?php wp_list_pages('sort_order=ASC&number=2'); ?>
</ul>

<ul>
<?php wp_list_pages('sort_order=DESC&number=2'); ?>
</ul>

number (integer) Sets the number of Pages to display. This causes the SQL LIMIT value to be defined. Default to no LIMIT.

Reference http://codex.wordpress.org/Function_Reference/wp_list_pages

于 2013-03-31T02:46:09.190 回答