0

I know this example doesn't show a lot of pages. But, on sites with dozens of pages, I have to go to the next page, scroll, sort by title, etc. to find the home page. Is there a way to have the home/front page always appear at the top of the list.

enter image description here

  • The different columns can be clicked to sort by column, which greatly complicates what you mean by appearing first, as you'd have to account for every single sort, and then again for descending/ascending. Are you sure you wouldn't prefer to get rid of the page and just use the standard home.php theme template? – Tom J Nowell May 15 '15 at 1:56
1

Manually ordering is an option, but menu_order is sorted ASC (0 first, then 1, 2, etc). Since Pages default to 0 you'd have to update all other Pages to menu_order 1+ to make your Front page go to the top. This may also have an impact elsewhere on your site, since menu_order is used fairly often.

To put both/either of the Static Pages first on the Admin edit Pages section, I made this quick snippet which you can place in your theme's functions.php file.

// Push Front Page & Posts Page to top of admin list
add_filter('posts_orderby', 'ezific_admin_static_pages_first', 10,2);
function ezific_admin_static_pages_first($orderby, $query) {
    // Leave if not Admin edit Pages query
    if (!( is_admin() && $query->is_main_query() && 'page' == $query->get( 'post_type' ) ))
        return $orderby;
    // Leave if neither static pages are set
    $front  = (int) get_option( 'page_on_front' );
    $posts  = (int) get_option( 'page_for_posts' );
    $ids    = implode(',', array_filter(array($posts,$front)));
    if ( empty($ids) )
        return $orderby;
    // Update the query
    global $wpdb;
    $orderby = 'FIELD('. $wpdb->posts.'.ID,' .$ids. ') DESC, ' . $orderby;
    return $orderby;
}
0

Yes there is!! If you hover over a page and click "Quick Edit" you will see a box that says "Order", set this to 0, then on the page you want to display next set it to 1. Then on the page you want to display third set it to 2.....etc

  • I tried setting home to 1, but it puts it at the very bottom (I'm assuming because all the others default to 0). This doesn't make sense because the number of pages will grow. Am I missing anything? – ansarob May 15 '15 at 1:54
  • Yes its because pages default to 0. That's just how it works. It's up to you to keep it organised. – ngearing May 15 '15 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.