';
if ( !empty( $hoot_options_premium ) && is_array( $hoot_options_premium ) ):
foreach ( $hoot_options_premium as $pkey => $pfeature ) :
if ( !empty( $pfeature['type'] ) && $pfeature['type'] == 'top' ) {
if ( !empty( $plink ) ) $pcontent .= '
' . $plinklabeltop . '
';
if ( !empty( $pdemo ) ) $pcontent .= '' . $plinklabeldemo . '
';
$pcontent .= '';
$containeropen = $topdisplayed = true;
} elseif ( !empty( $pfeature['type'] ) && $pfeature['type'] == 'bottom' ) {
if ( !empty( $plink ) ) $pcontent .= '
' . $plinklabelbottom . '
';
if ( $containeropen ) $pcontent .= '
';
$containeropen = false;
} else {
if ( !$topdisplayed ) {
if ( !empty( $pfeature['name'] ) ) $pcontent .= '' . $pfeature['name'] . '
';
if ( !empty( $pfeature['std'] ) ) $pcontent .= '' . $pfeature['std'] . '
';
} else {
$pcontent .= '';
if ( !empty( $pfeature['desc'] ) ) :
$pcontent .= '
';
$pcontent .= '
';
if ( !empty( $pfeature['name'] ) ) $pcontent .= '
' . $pfeature['name'] . '
';
$pcontent .= $pfeature['desc'];
$pcontent .= '';
if ( !empty( $pfeature['img'] ) ) $pcontent .= '
';
$pcontent .= '
';
$pcontent .= '
';
elseif ( !empty( $pfeature['name'] ) ) :
$pcontent .= '
' . $pfeature['name'] . '
';
endif;
if ( !empty( $pfeature['std'] ) ) $pcontent .= $pfeature['std'];
$pcontent .= '
';
}
}
endforeach;
if ( $containeropen ) $pcontent .= '';
endif;
$pcontent .= '';
echo $pcontent;
}
/**
* Reorder subpage in the appearance menu.
*
* @since 4.1
*/
function hoot_appearance_subpage_reorder() {
global $submenu;
$menu_slug = 'chromatic-premium';
$index = '';
if ( !isset( $submenu['themes.php'] ) ) {
// probably current user doesn't have this item in menu
return;
}
foreach ( $submenu['themes.php'] as $key => $sm ) {
if ( $sm[2] == $menu_slug ) {
$index = $key;
break;
}
}
if ( ! empty( $index ) ) {
//$item = $submenu['themes.php'][ $index ];
//unset( $submenu['themes.php'][ $index ] );
//array_splice( $submenu['themes.php'], 1, 0, array($item) );
/* array_splice does not preserve numeric keys, so instead we do our own rearranging. */
$smthemes = array();
foreach ( $submenu['themes.php'] as $key => $sm ) {
if ( $key != $index ) {
$setkey = $key;
for ( $i = $key; $i < 1000; $i++ ) {
if( !isset( $smthemes[$i] ) ) {
$setkey = $i;
break;
}
}
$smthemes[ $setkey ] = $sm;
if ( $sm[2] == 'themes.php' ) {
$smthemes[ $setkey + 1 ] = $submenu['themes.php'][ $index ];
}
}
}
$submenu['themes.php'] = $smthemes;
}
}
add_action( 'admin_menu', 'hoot_appearance_subpage_reorder', 9999 );