wp_list_pages( $args )
calls get_pages( $args )
. You can filter the get_pages()
output with a filter on get_pages
.
Let’s say you call wp_list_pages()
like this:
wp_list_pages(
array(
'please_filter_me' => TRUE
)
);
You can sort the pages now with code like this (not tested):
add_filter( 'get_pages', function( $pages, $args ) {
// not our query
if ( empty ( $args['please_filter_me'] ) )
return $pages;
$out = $top = array();
foreach ( $pages as $page )
{
if ( get_post_meta( $page->ID, 'my_key', TRUE ) )
$top[] = $page;
else
$out[] = $page;
}
return $top + $out;
}, 10, 2 );
Related Posts:
- How can I hide children of draft pages using wp_list_pages()?
- How to List All Pages (With their template names) Within a Website
- How can I list all pages with their templates?
- Add Parent to List of Subpages
- get all page IDs from wp_list_pages
- Add class to the items in wp_list_pages
- Display grandchildren on child and grandchild pages using wp_list_pages
- Load parent pages when there are no child pages
- create shortcode to show children if any otherwise siblings
- dynamically limit depth of wp_list_pages
- Conditional styling of wp_list_pages bullet points [closed]
- Setting multiple values to as sort_column
- Custom category listings
- How can I include private pages in a page list?
- Do Not Display Parent Page if No Subpages
- Arrange Combined List of Pages and Categories
- List pages within a certain parent and show published month
- Change Parent Name with wp_list_pages?
- List all Posts under heading in wp_list_pages menu
- $item->url not retrieving url in custom walker?
- WordPress Side Navigation with Parent Heading and Child Sub Pages
- List subpage of subpage
- wp_list_page with something like showpost
- How can I list all page titles and IDs?
- Hide Parent if No Children
- Add Parent to Subpage List
- active parent page when clicked on childpage
- alternating classes on wp_list_pages
- remove auto generated pages from the menu?
- Inset image thumbnail from page into list
- How to prevent custom walker from creating sub navigation for pages that are not relatives of the current page?
- Exclude current page in wp_list_pages
- Sub Navigation in Sidebar
- wp_list_pages bug in “number” parameter
- Targeting specific instane of wp_list_pages
- Renaming wp_list_pages class
- wp_list_pages issue/bug?
- WordPress get_pages sub nav show current page
- Change class name in WordPress wp_list_page nav
- Non page link in wp_list_pages
- only display Pages which have children
- add a.parent in wp_list_pages
- wp_list_pages by taxonomy?
- wp_list_pages Format only on Recently Modified Pages
- Adding custom class names to anchor in wp_list_pages
- Walker Class : extract function and wp_list_pages
- Exclude pages by custom field (with yes/no) storing wrong data?
- Highlighting current item of custom post types’ sub pages, listed by wp_list_pages
- Is there a way to make a custom Page type?
- Test if page is child and has children, if so echo child pages also on grandchild pages
- How to add active class to custom menu using while loop and wp_list_pages
- Exclude pages with certain template from wp_list_pages
- Check whether the child page has siblings
- Handling complex multi-level architecture / menu for large site
- How to get a list of all recently published child pages?
- List child pages of specific page using shortcode
- Pages inside a page (with thumbnails)
- Drag posts and pages so you can sort them in order
- wp_list_pages() but only show children on the branch you are on
- Help with Sub and Sub-Sub Navigation
- new_excerpt_more link not working properly
- How to get Role Subscribe Users on Admin Menu only in Pages in WordPress
- Displaying different page links on different pages
- need help with existing code showing subpages
- How to remove the HOME menu item
- query posts and split meta information into separate div’s
- Display custom post types in wp_list_pages
- include specific Pages to wp_list_pages with filter
- Get post and its children with WP_Query
- Thumbnails in ACF Query Results
- Using depth=n in wp_list_pages
- Sort and display pages with specific custom field (not tag)
- Get whole linked with wp_list_pages
- wp list pages using meta box value
- How to apply the ‘current_page_item’ class to an archive page in `wp_list_pages()`?
- add slug of child(ren) to li using wp_list_pages
- build child and anchestor three from post parent
- Exclude certain template from wp_list_pages
- Creating navigation out of specific IDs and their children?
- Wrap each child and it’s grandchildren separately
- Get All Pages as strings in array
- How to display data with pagaination on backend?
- Subpages List Appearing on Every Page
- WordPress list child pages of custom post type
- How To List Sibling Pages And Include The Featured Image?
- wp_list_pages, links only for pages with no children
- Include Custom Post Type Archive in wp_list_pages
- wp_list_pages change of children and anchor of parent
- How to use page metadata while using wp_list_pages()?
- Need some help with “the_widget()” function
- How to style this wp_list_pages markup
- How to make in post Parent page children page list nummbered
- Check if meta_key exists in wp_list_pages
- Display all submenus
- list child pages as slug
- Custom navigation bar via wp_list_pages is broken for blog roll
- Is it possible to append an external html file to my wordpress navigation?
- Change order that the menu is generated with wp_list_pages
- Custom wp_list_pages() function
- Wrapping a function in html tag and return?