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 a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

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

Let's Talk