Add order to positions during preset installation
This commit is contained in:
@@ -108,13 +108,13 @@ class SP_Admin_Sports {
|
|||||||
$name = sp_array_value( $position, 'name', __( 'Position', 'sportspress' ) );
|
$name = sp_array_value( $position, 'name', __( 'Position', 'sportspress' ) );
|
||||||
$sections = sp_array_value( $position, 'sections', array( 0, 1 ) );
|
$sections = sp_array_value( $position, 'sections', array( 0, 1 ) );
|
||||||
}
|
}
|
||||||
$slug = $i . '-' . sanitize_title( $name );
|
$term = wp_insert_term( $name, 'sp_position' );
|
||||||
$term = wp_insert_term( $name, 'sp_position', array( 'slug' => $slug ) );
|
|
||||||
if ( is_wp_error( $term ) ) continue;
|
if ( is_wp_error( $term ) ) continue;
|
||||||
$t_id = $term['term_id'];
|
$t_id = $term['term_id'];
|
||||||
$term_meta = get_option( "taxonomy_$t_id" );
|
$term_meta = get_option( "taxonomy_$t_id" );
|
||||||
$term_meta['sp_sections'] = $sections;
|
$term_meta['sp_sections'] = $sections;
|
||||||
update_option( "taxonomy_$t_id", $term_meta );
|
update_option( "taxonomy_$t_id", $term_meta );
|
||||||
|
update_term_meta( $t_id, 'sp_order', $i + 1 );
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user