Add order setting to taxonomies

This commit is contained in:
Brian Miyaji
2017-11-13 23:45:03 +11:00
parent bfd32a079f
commit 191896c55d
10 changed files with 266 additions and 30 deletions

View File

@@ -112,7 +112,20 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
$limit = $number;
if ( $grouping === 'position' ):
$groups = get_terms( 'sp_position', array( 'orderby' => 'slug' ) );
$groups = get_terms( 'sp_position', array(
'orderby' => 'meta_value_num',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'sp_order',
'compare' => 'NOT EXISTS'
),
array(
'key' => 'sp_order',
'compare' => 'EXISTS'
),
),
) );
else:
$group = new stdClass();
$group->term_id = null;

View File

@@ -79,7 +79,20 @@ endif;
$output = '';
if ( $grouping === 'position' ):
$groups = get_terms( 'sp_position', array( 'orderby' => 'slug' ) );
$groups = get_terms( 'sp_position', array(
'orderby' => 'meta_value_num',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'sp_order',
'compare' => 'NOT EXISTS'
),
array(
'key' => 'sp_order',
'compare' => 'EXISTS'
),
),
) );
else:
if ( $show_title && false === $title && $id ):
$caption = $list->caption;