Thanks @PieterGoosen and @realloc.
I came up with this solution:
Added meta_key=important&meta_value=1
in wp_list_pages()
.
And gonna use custom field for pages important: 1
.
This is for list of IMPORTANT child pages.
function important_list_child_pages() {
global $post;
if ( is_page() && $post->post_parent )
$childpages = wp_list_pages( 'meta_key=important&meta_value=1&sort_column=menu_order&title_li=&child_of=" . $post->post_parent . "&echo=0' );
else
$childpages = wp_list_pages( 'meta_key=important&meta_value=1&sort_column=menu_order&title_li=&child_of=" . $post->ID . "&echo=0' );
if ( $childpages ) {
$string = '<ul class="list-in-page-menu">' . $childpages . '</ul></div></div><div style="clear:both">';
}
return $string;
}
And this is for child pages excluded IMPORTANT ones
function non_important_child_pages() {
global $post;
$args=array(
'post_type' => 'page',
'meta_key' => 'important',
'meta_compare' => '=',
'meta_value' => '1'
);
$pages = get_posts($args);
if ($pages) {
$pageids = array();
foreach ($pages as $page) {
$pageids[]= $page->ID;
}
$excluded = 'exclude=".implode(",", $pageids);
}
if ( is_page() && $post->post_parent )
$childpages = wp_list_pages( "' . $excluded . '&sort_column=menu_order&title_li=&child_of=" . $post->post_parent . "&echo=0');
else
$childpages = wp_list_pages( '' . $excluded . '&sort_column=menu_order&title_li=&child_of=" . $post->ID . "&echo=0');
if ( $childpages ) {
$string = '<ul class="list-in-page-menu">' . $childpages . '</ul></div></div><div style="clear:both">';
}
return $string;
}