Clean up permalink save function
This commit is contained in:
@@ -82,10 +82,12 @@ class SP_Admin_Permalink_Settings {
|
|||||||
if ( ! is_admin() )
|
if ( ! is_admin() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) && isset( $_POST['product_permalink'] ) ):
|
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['sportspress_events_slug'] ) ):
|
||||||
foreach ( $this->slugs as $slug ):
|
foreach ( $this->slugs as $slug ):
|
||||||
$key = 'sportspress_' . $slug[0] . '_slug';
|
$key = 'sportspress_' . $slug[0] . '_slug';
|
||||||
$value = sanitize_text_field( $_POST[ $key ] );
|
$value = null;
|
||||||
|
if ( isset( $_POST[ $key ] ) )
|
||||||
|
$value = sanitize_text_field( $_POST[ $key ] );
|
||||||
if ( empty( $value ) )
|
if ( empty( $value ) )
|
||||||
delete_option( $key );
|
delete_option( $key );
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ class SP_Admin_Meta_Boxes {
|
|||||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Column_Details::output', 'sp_column', 'normal', 'high' );
|
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Column_Details::output', 'sp_column', 'normal', 'high' );
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'default' );
|
|
||||||
add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'SP_Meta_Box_Event_Format::output', 'sp_event', 'side', 'default' );
|
add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'SP_Meta_Box_Event_Format::output', 'sp_event', 'side', 'default' );
|
||||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' );
|
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' );
|
||||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'SP_Meta_Box_Event_Teams::output', 'sp_event', 'side', 'default' );
|
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'SP_Meta_Box_Event_Teams::output', 'sp_event', 'side', 'default' );
|
||||||
@@ -131,7 +130,6 @@ class SP_Admin_Meta_Boxes {
|
|||||||
public function remove_meta_boxes() {
|
public function remove_meta_boxes() {
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
remove_meta_box( 'submitdiv', 'sp_event', 'side' );
|
|
||||||
remove_meta_box( 'sp_venuediv', 'sp_event', 'side' );
|
remove_meta_box( 'sp_venuediv', 'sp_event', 'side' );
|
||||||
remove_meta_box( 'sp_leaguediv', 'sp_event', 'side' );
|
remove_meta_box( 'sp_leaguediv', 'sp_event', 'side' );
|
||||||
remove_meta_box( 'sp_seasondiv', 'sp_event', 'side' );
|
remove_meta_box( 'sp_seasondiv', 'sp_event', 'side' );
|
||||||
@@ -161,11 +159,11 @@ class SP_Admin_Meta_Boxes {
|
|||||||
public function rename_meta_boxes() {
|
public function rename_meta_boxes() {
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
// Comments/Reviews
|
// Publish/Event
|
||||||
if ( isset( $post ) && ( 'publish' == $post->post_status || 'private' == $post->post_status ) ) {
|
if ( isset( $post ) ) {
|
||||||
remove_meta_box( 'commentsdiv', 'product', 'normal' );
|
remove_meta_box( 'submitdiv', 'sp_event', 'side' );
|
||||||
|
|
||||||
add_meta_box( 'commentsdiv', __( 'Reviews', 'sportspress' ), 'post_comment_meta_box', 'product', 'normal' );
|
add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'high' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ class SP_Post_types {
|
|||||||
* Register SportsPress taxonomies.
|
* Register SportsPress taxonomies.
|
||||||
*/
|
*/
|
||||||
public static function register_taxonomies() {
|
public static function register_taxonomies() {
|
||||||
if ( taxonomy_exists( 'product_type' ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
do_action( 'sportspress_register_taxonomy' );
|
do_action( 'sportspress_register_taxonomy' );
|
||||||
|
|
||||||
$labels = array(
|
$labels = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user