Changing order of Staff members
URL to the page in question:
-
Hi Bill,
How do you order the staff members on a page? I tried to use the “order” field but the order of the staff members on our staff type page did not change. I saw a similar question on this forum regarding changing the order of sponsorers, but I tried to change the code that you suggested but it looked as though that was already default.
The page I’m working on is http://www.dreamlinkusa.org/staff-group/board-of-directors/
Thank you!
Sarah
Sarah,
Thank you for your business first of all. You can set things up so that your page order is reflected in the staff groups. Here’s what to do:
- Go to the Appearance section and select Edit.
- From the list of files on your right, choose functions.php and scroll down to the very bottom.
- Paste this:
// Adds order to posts before the query is run
function sarah_pre_posts( $query ) {
if ( is_tax( 'sponsor-group' ) ) {
// displays in post order
$query->set( 'order', 'ASC' );
$query->set( 'orderby', 'menu_order' );
return;
}
if ( is_tax( 'staff-group' ) ) {
// displays in post order
$query->set( 'order', 'ASC' );
$query->set( 'orderby', 'menu_order' );
return;
}
}
add_action( 'pre_get_posts', 'sarah_pre_posts', 1 );
- Save your changes.
Now the order should be respected inside your sponsor and staff groups. This will be part of the next theme update. It uses a newer WordPress function to make that possible.
You also might like to use the Simple Page Ordering plugin. It lets you drag and drop your sponsors and staff to place them in order, right from the listing screen.
If you have any questions or trouble, let me know,
Bill
Thank you so much! This worked perfectly.
So glad to hear that. If you need anything else, just let me know.
Take care,
Bill
- The topic ‘Changing order of Staff members’ is closed to new replies.