Add order setting to taxonomies
This commit is contained in:
@@ -157,6 +157,10 @@
|
|||||||
color: #888;
|
color: #888;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-table td input.sp-number-input {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
/* Settings */
|
/* Settings */
|
||||||
.sportspress table.form-table, .sportspress table.form-table .forminp-radio ul {
|
.sportspress table.form-table, .sportspress table.form-table .forminp-radio ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ class SP_Admin_Taxonomies {
|
|||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
||||||
|
// Add league field
|
||||||
|
add_action( 'sp_league_edit_form_fields', array( $this, 'edit_taxonomy_fields' ), 10, 1 );
|
||||||
|
add_action( 'edited_sp_league', array( $this, 'save_fields' ), 10, 1 );
|
||||||
|
|
||||||
|
// Add season field
|
||||||
|
add_action( 'sp_season_edit_form_fields', array( $this, 'edit_taxonomy_fields' ), 10, 1 );
|
||||||
|
add_action( 'edited_sp_season', array( $this, 'save_fields' ), 10, 1 );
|
||||||
|
|
||||||
// Add venue field
|
// Add venue field
|
||||||
add_action( 'sp_venue_add_form_fields', array( $this, 'add_venue_fields' ) );
|
add_action( 'sp_venue_add_form_fields', array( $this, 'add_venue_fields' ) );
|
||||||
add_action( 'sp_venue_edit_form_fields', array( $this, 'edit_venue_fields' ), 10, 1 );
|
add_action( 'sp_venue_edit_form_fields', array( $this, 'edit_venue_fields' ), 10, 1 );
|
||||||
@@ -31,9 +39,13 @@ class SP_Admin_Taxonomies {
|
|||||||
add_action( 'edited_sp_position', array( $this, 'save_fields' ), 10, 1 );
|
add_action( 'edited_sp_position', array( $this, 'save_fields' ), 10, 1 );
|
||||||
add_action( 'create_sp_position', array( $this, 'save_fields' ), 10, 1 );
|
add_action( 'create_sp_position', array( $this, 'save_fields' ), 10, 1 );
|
||||||
|
|
||||||
// Change league and season columns
|
// Change league columns
|
||||||
add_filter( 'manage_edit-sp_league_columns', array( $this, 'taxonomy_columns' ) );
|
add_filter( 'manage_edit-sp_league_columns', array( $this, 'taxonomy_columns' ) );
|
||||||
|
add_filter( 'manage_sp_league_custom_column', array( $this, 'column_value' ), 10, 3 );
|
||||||
|
|
||||||
|
// Change league columns
|
||||||
add_filter( 'manage_edit-sp_season_columns', array( $this, 'taxonomy_columns' ) );
|
add_filter( 'manage_edit-sp_season_columns', array( $this, 'taxonomy_columns' ) );
|
||||||
|
add_filter( 'manage_sp_season_custom_column', array( $this, 'column_value' ), 10, 3 );
|
||||||
|
|
||||||
// Change venue columns
|
// Change venue columns
|
||||||
add_filter( 'manage_edit-sp_venue_columns', array( $this, 'venue_columns' ) );
|
add_filter( 'manage_edit-sp_venue_columns', array( $this, 'venue_columns' ) );
|
||||||
@@ -42,9 +54,25 @@ class SP_Admin_Taxonomies {
|
|||||||
// Change position columns
|
// Change position columns
|
||||||
add_filter( 'manage_edit-sp_position_columns', array( $this, 'position_columns' ) );
|
add_filter( 'manage_edit-sp_position_columns', array( $this, 'position_columns' ) );
|
||||||
add_filter( 'manage_sp_position_custom_column', array( $this, 'column_value' ), 10, 3 );
|
add_filter( 'manage_sp_position_custom_column', array( $this, 'column_value' ), 10, 3 );
|
||||||
|
}
|
||||||
|
|
||||||
// Change role columns
|
/**
|
||||||
add_filter( 'manage_edit-sp_role_columns', array( $this, 'role_columns' ) );
|
* Edit league/season fields.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param mixed $term Term (category) being edited
|
||||||
|
*/
|
||||||
|
public function edit_taxonomy_fields( $term ) {
|
||||||
|
$t_id = $term->term_id;
|
||||||
|
?>
|
||||||
|
<?php if ( function_exists( 'get_term_meta' ) ) { ?>
|
||||||
|
<?php $order = get_term_meta( $t_id, 'sp_order', true ); ?>
|
||||||
|
<tr class="form-field">
|
||||||
|
<th scope="row" valign="top"><label for="sp_order"><?php _e( 'Order', 'sportspress' ); ?></label></th>
|
||||||
|
<td><input name="sp_order" class="sp-number-input" type="text" step="1" size="4" id="sp_order" value="<?php echo (int) $order; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,8 +197,13 @@ class SP_Admin_Taxonomies {
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php if ( function_exists( 'get_term_meta' ) ) { ?>
|
||||||
</div>
|
<?php $order = get_term_meta( $t_id, 'sp_order', true ); ?>
|
||||||
|
<tr class="form-field">
|
||||||
|
<th scope="row" valign="top"><label for="sp_order"><?php _e( 'Order', 'sportspress' ); ?></label></th>
|
||||||
|
<td><input name="sp_order" class="sp-number-input" type="text" step="1" size="4" id="sp_order" value="<?php echo (int) $order; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +226,9 @@ class SP_Admin_Taxonomies {
|
|||||||
}
|
}
|
||||||
update_option( "taxonomy_$t_id", $term_meta );
|
update_option( "taxonomy_$t_id", $term_meta );
|
||||||
}
|
}
|
||||||
|
if ( function_exists( 'add_term_meta' ) ) {
|
||||||
|
update_term_meta( $term_id, 'sp_order', (int) sp_array_value( $_POST, 'sp_order', 0 ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,8 +239,15 @@ class SP_Admin_Taxonomies {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function taxonomy_columns( $columns ) {
|
public function taxonomy_columns( $columns ) {
|
||||||
$columns['posts'] = __( 'Events', 'sportspress' );
|
$new_columns = array();
|
||||||
return $columns;
|
|
||||||
|
if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
|
||||||
|
|
||||||
|
$new_columns['posts'] = $columns['posts'];
|
||||||
|
|
||||||
|
unset( $columns['posts'] );
|
||||||
|
|
||||||
|
return array_merge( $columns, $new_columns );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -217,7 +260,7 @@ class SP_Admin_Taxonomies {
|
|||||||
public function venue_columns( $columns ) {
|
public function venue_columns( $columns ) {
|
||||||
$new_columns = array();
|
$new_columns = array();
|
||||||
$new_columns['sp_address'] = __( 'Address', 'sportspress' );
|
$new_columns['sp_address'] = __( 'Address', 'sportspress' );
|
||||||
$new_columns['posts'] = __( 'Events', 'sportspress' );
|
$new_columns['posts'] = $columns['posts'];
|
||||||
|
|
||||||
unset( $columns['description'] );
|
unset( $columns['description'] );
|
||||||
unset( $columns['slug'] );
|
unset( $columns['slug'] );
|
||||||
@@ -236,7 +279,9 @@ class SP_Admin_Taxonomies {
|
|||||||
public function position_columns( $columns ) {
|
public function position_columns( $columns ) {
|
||||||
$new_columns = array();
|
$new_columns = array();
|
||||||
$new_columns['sp_sections'] = __( 'Statistics', 'sportspress' );
|
$new_columns['sp_sections'] = __( 'Statistics', 'sportspress' );
|
||||||
$new_columns['posts'] = __( 'Players', 'sportspress' );
|
|
||||||
|
if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
|
||||||
|
$new_columns['posts'] = $columns['posts'];
|
||||||
|
|
||||||
unset( $columns['description'] );
|
unset( $columns['description'] );
|
||||||
unset( $columns['slug'] );
|
unset( $columns['slug'] );
|
||||||
@@ -245,18 +290,6 @@ class SP_Admin_Taxonomies {
|
|||||||
return array_merge( $columns, $new_columns );
|
return array_merge( $columns, $new_columns );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Posts column changed to Staff in admin.
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param mixed $columns
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function role_columns( $columns ) {
|
|
||||||
$columns['posts'] = __( 'Staff', 'sportspress' );
|
|
||||||
return $columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Column value added to category admin.
|
* Column value added to category admin.
|
||||||
*
|
*
|
||||||
@@ -294,6 +327,10 @@ class SP_Admin_Taxonomies {
|
|||||||
|
|
||||||
$columns .= implode( ', ', $section_names );
|
$columns .= implode( ', ', $section_names );
|
||||||
|
|
||||||
|
} elseif ( $column == 'sp_order' ) {
|
||||||
|
|
||||||
|
$columns = (int) get_term_meta( $id, 'sp_order', true );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $columns;
|
return $columns;
|
||||||
|
|||||||
@@ -23,7 +23,18 @@ class SP_Meta_Box_Event_Officials {
|
|||||||
$duties = get_terms( array(
|
$duties = get_terms( array(
|
||||||
'taxonomy' => 'sp_duty',
|
'taxonomy' => 'sp_duty',
|
||||||
'hide_empty' => false,
|
'hide_empty' => false,
|
||||||
'orderby' => 'slug',
|
'orderby' => 'meta_value_num',
|
||||||
|
'meta_query' => array(
|
||||||
|
'relation' => 'OR',
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'NOT EXISTS'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'EXISTS'
|
||||||
|
),
|
||||||
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$officials = (array) get_post_meta( $post->ID, 'sp_officials', true );
|
$officials = (array) get_post_meta( $post->ID, 'sp_officials', true );
|
||||||
|
|||||||
@@ -414,7 +414,18 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
'taxonomy' => 'sp_position',
|
'taxonomy' => 'sp_position',
|
||||||
'name' => 'sp_players[' . $team_id . '][' . $player_id . '][position][]',
|
'name' => 'sp_players[' . $team_id . '][' . $player_id . '][position][]',
|
||||||
'values' => 'term_id',
|
'values' => 'term_id',
|
||||||
'orderby' => 'slug',
|
'orderby' => 'meta_value_num',
|
||||||
|
'meta_query' => array(
|
||||||
|
'relation' => 'OR',
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'NOT EXISTS'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'EXISTS'
|
||||||
|
),
|
||||||
|
),
|
||||||
'selected' => $selected,
|
'selected' => $selected,
|
||||||
'class' => 'sp-position',
|
'class' => 'sp-position',
|
||||||
'property' => 'multiple',
|
'property' => 'multiple',
|
||||||
|
|||||||
@@ -129,7 +129,18 @@ class SP_Meta_Box_List_Data {
|
|||||||
'name' => 'sp_players[' . $player_id . '][position]',
|
'name' => 'sp_players[' . $player_id . '][position]',
|
||||||
'show_option_blank' => __( '(Auto)', 'sportspress' ),
|
'show_option_blank' => __( '(Auto)', 'sportspress' ),
|
||||||
'values' => 'term_id',
|
'values' => 'term_id',
|
||||||
'orderby' => 'slug',
|
'orderby' => 'meta_value_num',
|
||||||
|
'meta_query' => array(
|
||||||
|
'relation' => 'OR',
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'NOT EXISTS'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'EXISTS'
|
||||||
|
),
|
||||||
|
),
|
||||||
'selected' => $selected,
|
'selected' => $selected,
|
||||||
'include_children' => ( 'no' == get_option( 'sportspress_event_hide_child_positions', 'no' ) ),
|
'include_children' => ( 'no' == get_option( 'sportspress_event_hide_child_positions', 'no' ) ),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -551,7 +551,18 @@ class SP_Event extends SP_Custom_Post{
|
|||||||
$duties = get_terms( array(
|
$duties = get_terms( array(
|
||||||
'taxonomy' => 'sp_duty',
|
'taxonomy' => 'sp_duty',
|
||||||
'hide_empty' => false,
|
'hide_empty' => false,
|
||||||
'orderby' => 'slug',
|
'orderby' => 'meta_value_num',
|
||||||
|
'meta_query' => array(
|
||||||
|
'relation' => 'OR',
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'NOT EXISTS'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'EXISTS'
|
||||||
|
),
|
||||||
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
if ( ! $include_empty && empty( $duties ) ) return null;
|
if ( ! $include_empty && empty( $duties ) ) return null;
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ class SportsPress_Officials {
|
|||||||
add_action( 'sportspress_event_list_row', array( $this, 'event_list_row' ), 10, 2 );
|
add_action( 'sportspress_event_list_row', array( $this, 'event_list_row' ), 10, 2 );
|
||||||
add_action( 'sportspress_calendar_data_meta_box_table_head_row', array( $this, 'calendar_meta_head_row' ) );
|
add_action( 'sportspress_calendar_data_meta_box_table_head_row', array( $this, 'calendar_meta_head_row' ) );
|
||||||
add_action( 'sportspress_calendar_data_meta_box_table_row', array( $this, 'calendar_meta_row' ), 10, 2 );
|
add_action( 'sportspress_calendar_data_meta_box_table_row', array( $this, 'calendar_meta_row' ), 10, 2 );
|
||||||
|
add_action( 'sp_duty_edit_form_fields', array( $this, 'edit_taxonomy_fields' ), 10, 1 );
|
||||||
|
add_action( 'edited_sp_duty', array( $this, 'save_taxonomy_fields' ), 10, 1 );
|
||||||
|
|
||||||
// Filters
|
// Filters
|
||||||
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
||||||
@@ -49,6 +51,8 @@ class SportsPress_Officials {
|
|||||||
add_filter( 'sportspress_post_types', array( $this, 'add_post_type' ) );
|
add_filter( 'sportspress_post_types', array( $this, 'add_post_type' ) );
|
||||||
add_filter( 'sportspress_primary_post_types', array( $this, 'add_post_type' ) );
|
add_filter( 'sportspress_primary_post_types', array( $this, 'add_post_type' ) );
|
||||||
add_filter( 'sportspress_post_type_hierarchy', array( $this, 'add_to_hierarchy' ) );
|
add_filter( 'sportspress_post_type_hierarchy', array( $this, 'add_to_hierarchy' ) );
|
||||||
|
add_filter( 'manage_edit-sp_duty_columns', array( $this, 'taxonomy_columns' ) );
|
||||||
|
add_filter( 'manage_sp_duty_custom_column', array( $this, 'taxonomy_column_value' ), 10, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,7 +201,18 @@ class SportsPress_Officials {
|
|||||||
$duties = get_terms( array(
|
$duties = get_terms( array(
|
||||||
'taxonomy' => 'sp_duty',
|
'taxonomy' => 'sp_duty',
|
||||||
'hide_empty' => false,
|
'hide_empty' => false,
|
||||||
'orderby' => 'slug',
|
'orderby' => 'meta_value_num',
|
||||||
|
'meta_query' => array(
|
||||||
|
'relation' => 'OR',
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'NOT EXISTS'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'EXISTS'
|
||||||
|
),
|
||||||
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
if ( empty( $duties ) ) return;
|
if ( empty( $duties ) ) return;
|
||||||
@@ -239,7 +254,18 @@ class SportsPress_Officials {
|
|||||||
$duties = get_terms( array(
|
$duties = get_terms( array(
|
||||||
'taxonomy' => 'sp_duty',
|
'taxonomy' => 'sp_duty',
|
||||||
'hide_empty' => false,
|
'hide_empty' => false,
|
||||||
'orderby' => 'slug',
|
'orderby' => 'meta_value_num',
|
||||||
|
'meta_query' => array(
|
||||||
|
'relation' => 'OR',
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'NOT EXISTS'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'key' => 'sp_order',
|
||||||
|
'compare' => 'EXISTS'
|
||||||
|
),
|
||||||
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
if ( empty( $duties ) ) return;
|
if ( empty( $duties ) ) return;
|
||||||
@@ -442,6 +468,8 @@ class SportsPress_Officials {
|
|||||||
return array_merge( $ids, array(
|
return array_merge( $ids, array(
|
||||||
'sp_official',
|
'sp_official',
|
||||||
'edit-sp_official',
|
'edit-sp_official',
|
||||||
|
'sp_duty',
|
||||||
|
'edit-sp_duty',
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,6 +482,103 @@ class SportsPress_Officials {
|
|||||||
$hierarchy['sp_official'] = array();
|
$hierarchy['sp_official'] = array();
|
||||||
return $hierarchy;
|
return $hierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Taxonomy columns.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param mixed $columns
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function taxonomy_columns( $columns ) {
|
||||||
|
$new_columns = array();
|
||||||
|
|
||||||
|
if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
|
||||||
|
|
||||||
|
$new_columns['posts'] = $columns['posts'];
|
||||||
|
|
||||||
|
unset( $columns['posts'] );
|
||||||
|
|
||||||
|
return array_merge( $columns, $new_columns );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit taxonomy fields.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param mixed $term Term (category) being edited
|
||||||
|
*/
|
||||||
|
public function edit_taxonomy_fields( $term ) {
|
||||||
|
$t_id = $term->term_id;
|
||||||
|
?>
|
||||||
|
<?php if ( function_exists( 'get_term_meta' ) ) { ?>
|
||||||
|
<?php $order = get_term_meta( $t_id, 'sp_order', true ); ?>
|
||||||
|
<tr class="form-field">
|
||||||
|
<th scope="row" valign="top"><label for="sp_order"><?php _e( 'Order', 'sportspress' ); ?></label></th>
|
||||||
|
<td><input name="sp_order" class="sp-number-input" type="text" step="1" size="4" id="sp_order" value="<?php echo (int) $order; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save taxonomy fields.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param mixed $term_id Term ID being saved
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function save_taxonomy_fields( $term_id ) {
|
||||||
|
if ( function_exists( 'add_term_meta' ) ) {
|
||||||
|
update_term_meta( $term_id, 'sp_order', (int) sp_array_value( $_POST, 'sp_order', 0 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Column value added to category admin.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param mixed $columns
|
||||||
|
* @param mixed $column
|
||||||
|
* @param mixed $id
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function taxonomy_column_value( $columns, $column, $id ) {
|
||||||
|
|
||||||
|
if ( $column == 'sp_address' ) {
|
||||||
|
|
||||||
|
$term_meta = get_option( "taxonomy_$id" );
|
||||||
|
|
||||||
|
$address = ( isset( $term_meta['sp_address'] ) ? $term_meta['sp_address'] : '—' );
|
||||||
|
|
||||||
|
$columns .= $address;
|
||||||
|
|
||||||
|
} elseif ( $column == 'sp_sections' ) {
|
||||||
|
|
||||||
|
$options = apply_filters( 'sportspress_performance_sections', array( 0 => __( 'Offense', 'sportspress' ), 1 => __( 'Defense', 'sportspress' ) ) );
|
||||||
|
|
||||||
|
$sections = sp_get_term_sections( $id );
|
||||||
|
|
||||||
|
$section_names = array();
|
||||||
|
|
||||||
|
if ( is_array( $sections ) ) {
|
||||||
|
foreach ( $sections as $section ) {
|
||||||
|
if ( array_key_exists( $section, $options ) ) {
|
||||||
|
$section_names[] = $options[ $section ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$columns .= implode( ', ', $section_names );
|
||||||
|
|
||||||
|
} elseif ( $column == 'sp_order' ) {
|
||||||
|
|
||||||
|
$columns = (int) get_term_meta( $id, 'sp_order', true );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class SportsPress_Overview {
|
|||||||
<li class="sp-home"><a class="button disabled"><?php _e( 'SportsPress', 'sportspress' ); ?></a></li>
|
<li class="sp-home"><a class="button disabled"><?php _e( 'SportsPress', 'sportspress' ); ?></a></li>
|
||||||
<?php foreach ( $taxonomies as $taxonomy ): $object = get_taxonomy( $taxonomy ); $post_types = apply_filters( 'sportspress_sitemap_taxonomy_post_types', $object->object_type, $taxonomy ); ?>
|
<?php foreach ( $taxonomies as $taxonomy ): $object = get_taxonomy( $taxonomy ); $post_types = apply_filters( 'sportspress_sitemap_taxonomy_post_types', $object->object_type, $taxonomy ); ?>
|
||||||
<li><a class="button button-primary" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress-overview', 'taxonomy' => $taxonomy ), 'admin.php' ) ) ); ?>"><?php echo $object->labels->name; ?></a>
|
<li><a class="button button-primary" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress-overview', 'taxonomy' => $taxonomy ), 'admin.php' ) ) ); ?>"><?php echo $object->labels->name; ?></a>
|
||||||
<?php $terms = get_terms( $taxonomy, array( 'hide_empty' => false, 'parent' => 0, 'orderby' => 'slug' ) ); ?>
|
<?php $terms = get_terms( $taxonomy, array( 'hide_empty' => false, 'parent' => 0, 'orderby' => 'slug', ) ); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php if ( sizeof( $terms ) > 0 ): ?>
|
<?php if ( sizeof( $terms ) > 0 ): ?>
|
||||||
<?php foreach ( $terms as $term ): ?>
|
<?php foreach ( $terms as $term ): ?>
|
||||||
|
|||||||
@@ -112,7 +112,20 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
|
|||||||
$limit = $number;
|
$limit = $number;
|
||||||
|
|
||||||
if ( $grouping === 'position' ):
|
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:
|
else:
|
||||||
$group = new stdClass();
|
$group = new stdClass();
|
||||||
$group->term_id = null;
|
$group->term_id = null;
|
||||||
|
|||||||
@@ -79,7 +79,20 @@ endif;
|
|||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if ( $grouping === 'position' ):
|
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:
|
else:
|
||||||
if ( $show_title && false === $title && $id ):
|
if ( $show_title && false === $title && $id ):
|
||||||
$caption = $list->caption;
|
$caption = $list->caption;
|
||||||
|
|||||||
Reference in New Issue
Block a user