Opened 15 years ago
Closed 9 years ago
#11095 closed enhancement (fixed)
Format wp_list_pages and wp_page_menu without <li> tags
Reported by: | zialingua | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | template | Cc: |
Description
Would that be possible to have the functions wp_list_pages and wp_page_menu with an option to display pages in a "flat" format like the functions wp_list_bookmarks or wp_tag_cloud or wp_get_archives?
Attachments (2)
Change History (17)
#1
@
15 years ago
- Component changed from General to Template
- Keywords wp_list_pages wp_page_menu removed
- Type changed from defect (bug) to feature request
#4
@
10 years ago
- Keywords has-patch added
These have limited use (especially when 'title_li' is present), but with the patch we can:
- Flatten the output (without re-ordering)
<ul> <?php $args = array( 'format' => 'custom', 'before' => '<li class="%s">', 'after' => '</li>', 'title_li' => null ); wp_list_pages( $args ); ?> </ul> <!-- produces --> <ul> <li class="page_item page-item-1"><a href="http://src.wordpress-develop.dev?p=1">Parent Page</a></li> <li class="page_item page-item-3"><a href="http://src.wordpress-develop.dev?p=3">Child Page</a></li> <li class="page_item page-item-2"><a href="http://src.wordpress-develop.dev?p=2">Second Parent</a></li> </ul>
- Wrap links in other elements
<?php $args = array( 'format' => 'custom', 'before' => '<span class="%s">', 'after' => '</span>', 'title_li' => null ); wp_list_pages( $args ); ?> <!-- produces --> <span class="page_item page-item-1"><a href="http://src.wordpress-develop.dev?p=1">Parent Page</a></span> <span class="page_item page-item-3"><a href="http://src.wordpress-develop.dev?p=3">Child Page</a></span> <span class="page_item page-item-2"><a href="http://src.wordpress-develop.dev?p=2">Second Parent</a></span>
- Add icons, entities, or whatever other items (that should most likely be CSS pseudo-elements):
<?php $args = array( 'format' => 'custom', 'before' => '* ', 'title_li' => null ); wp_list_pages( $args ); ?> <!-- produces --> * <a href="http://src.wordpress-develop.dev?p=1">Parent Page</a> * <a href="http://src.wordpress-develop.dev?p=3">Child Page</a> * <a href="http://src.wordpress-develop.dev?p=2">Second Parent</a>
Patch also adds tests for wp_page_menu()
.
#5
@
9 years ago
- Keywords needs-patch added; has-patch removed
- Milestone changed from Future Release to 4.4
- Type changed from feature request to enhancement
Seems like wp_page_menu()
needs to be able to accept 'walker'
and remove some of the hardcoded HTML bits. wp_list_pages()
already accepts 'walker'
#6
@
9 years ago
- Owner set to wonderboymusic
- Resolution set to fixed
- Status changed from new to closed
In 34200:
#7
@
9 years ago
- Keywords needs-docs added
- Resolution fixed deleted
- Status changed from closed to reopened
Documentation for the three new arguments needs to be added to the hash notation for $args
. Also, a changelog entry, please :-)
#13
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
[34243] broke back compat for themes adding a home link by checking ! isset( $args['show_home'] )
, including Twenty Ten and Twenty Eleven.
I think we should leave the docs but remove the actual declaration in the default array for show_home
.
Adds 'format', 'before', and 'after' arguments to wp_list_pages()