BE Subpages Widget – Alphabetical Order

The BE Subpages Widget plugin, it displays a listing of the current section’s subpages. By default it sorts them by menu order, but the code below will change it to alphabetical order. Add this to your theme’s functions.php file or a core functionality plugin.

/**
 * Alphabetically sort subpages
 * 
 * @link http://www.billerickson.net/code/subpages-widget-alphabetical-order/
 * @author Bill Erickson
 * 
 * @param array $args, query arguments
 * @return array $args
 */
function ea_alphabetically_sort_subpages( $args ) {
    $args['sort_column'] = 'post_title';
    $args['sort_order'] = 'ASC';
    return $args;
}
add_filter( 'be_subpages_widget_args', 'ea_alphabetically_sort_subpages' );

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk