Add function to check if post type is config type
This commit is contained in:
@@ -352,9 +352,6 @@ jQuery(document).ready(function($){
|
|||||||
$(this).siblings(".example").html(example);
|
$(this).siblings(".example").html(example);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove slug editor in quick edit for slug-sensitive post types
|
|
||||||
$(".inline-edit-sp_result, .inline-edit-sp_outcome, .inline-edit-sp_column, .inline-edit-sp_performance").find("input[name=post_name]").closest("label").remove();
|
|
||||||
|
|
||||||
// Prevent address input from submitting form
|
// Prevent address input from submitting form
|
||||||
$(".sp-address").keypress(function(event) {
|
$(".sp-address").keypress(function(event) {
|
||||||
return event.keyCode != 13;
|
return event.keyCode != 13;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class SP_Admin_Menus {
|
|||||||
*/
|
*/
|
||||||
public function menu_highlight() {
|
public function menu_highlight() {
|
||||||
global $typenow, $submenu;
|
global $typenow, $submenu;
|
||||||
if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric' ) ) )
|
if ( sp_is_config_type( $typenow ) )
|
||||||
$this->highlight_admin_menu( 'sportspress', null );
|
$this->highlight_admin_menu( 'sportspress', null );
|
||||||
elseif ( $typenow == 'sp_calendar' )
|
elseif ( $typenow == 'sp_calendar' )
|
||||||
$this->highlight_admin_menu( 'edit.php?post_type=sp_event', 'edit.php?post_type=sp_calendar' );
|
$this->highlight_admin_menu( 'edit.php?post_type=sp_event', 'edit.php?post_type=sp_calendar' );
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class SP_Admin_Post_Types {
|
|||||||
public function post_updated_messages( $messages ) {
|
public function post_updated_messages( $messages ) {
|
||||||
global $typenow, $post;
|
global $typenow, $post;
|
||||||
|
|
||||||
if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_metric', 'sp_performance' ) ) ):
|
if ( sp_is_config_type( $typenow ) ):
|
||||||
$obj = get_post_type_object( $typenow );
|
$obj = get_post_type_object( $typenow );
|
||||||
|
|
||||||
for ( $i = 0; $i <= 10; $i++ ):
|
for ( $i = 0; $i <= 10; $i++ ):
|
||||||
|
|||||||
@@ -5289,3 +5289,13 @@ function sp_get_text_options() {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sp_is_config_type( $typenow = null ) {
|
||||||
|
if ( $typenow == null ) global $typenow;
|
||||||
|
|
||||||
|
$post_types = array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric' );
|
||||||
|
|
||||||
|
if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric' ) ) )
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user