Use array_keys to prevent error in admin

This commit is contained in:
Brian Miyaji
2016-08-22 10:27:14 +10:00
parent d4ad479196
commit a654a090e6
2 changed files with 3 additions and 3 deletions

View File

@@ -91,7 +91,7 @@ class SP_Settings_Page {
$templates = array_merge( array_flip( $layout ), $templates );
$slice = array_search( 'tabs', array_flip( $templates ) );
$slice = array_search( 'tabs', array_keys( $templates ) );
if ( $slice ) {
$templates = array_slice( $templates, 0, $slice );
}
@@ -144,7 +144,7 @@ class SP_Settings_Page {
$templates = array_merge( array_flip( $layout ), $templates );
$slice = array_search( 'tabs', array_flip( $templates ) );
$slice = array_search( 'tabs', array_keys( $templates ) );
if ( $slice ) {
$templates = array_slice( $templates, $slice );
} else {

View File

@@ -75,7 +75,7 @@ class SP_Template_Loader {
$templates = apply_filters( 'sportspress_' . $type . '_templates', $templates );
// Split templates into sections and tabs
$slice = array_search( 'tabs', array_flip( $templates ) );
$slice = array_search( 'tabs', array_keys( $templates ) );
if ( $slice ) {
$section_templates = array_slice( $templates, 0, $slice );
$tab_templates = array_slice( $templates, $slice );