What I need basically is to display child pages on a parent. But I want to split the list of childs to, lets say, 'important' and 'non-important' to display it at the beginning and at the end of a parent page.
I turned on TAGs for pages in function.php like:
function tags_support_all() {
register_taxonomy_for_object_type('post_tag', 'page');
}
// ensure all tags are included in queries
function tags_support_query($wp_query) {
if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
}
// tag hooks
add_action('init', 'tags_support_all');
add_action('pre_get_posts', 'tags_support_query');
And here's my function and shortcode to display ALL childs on a parent:
function my_list_child_pages() {
global $post;
if ( is_page() && $post->post_parent )
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' );
else
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' );
if ( $childpages ) {
$string = '<ul class="list-in-page-menu">' . $childpages . '</ul><div style="clear:both">';
}
return $string;
}
add_shortcode('my_childpages', 'my_list_child_pages');
But I can't figure out how to sort out child pages with tag 'important' in this function.
Is it possible at all?