%s/div>',
esc_html__( 'By Post Type', 'custom-sidebars' )
);
echo '
';
$list = $import['options']['post_type_single'];
$list['foo'] = array();
foreach ( $list as $key => $values ) {
if ( ! count( $values ) ) {
continue;
}
/**
* check post type exists
*/
$type = get_post_type_object( $key );
if ( ! is_a( $type, 'WP_Post_Type' ) ) {
continue;
}
list_sidebar_replacement( $type->labels->name, $values );
}
echo '
';
}
/**
* archive-posttype
*/
if (
isset( $import['options'] )
&& isset( $import['options']['post_type_archive'] )
&& is_array( $import['options']['post_type_archive'] )
) {
?>
$values ) {
$type = get_post_type_object( $key );
if ( ! count( $values ) ) { continue; }
list_sidebar_replacement( $type->labels->name, $values );
}
echo '
';
}
/*
* single-category
*/
if (
isset( $import['options'] )
&& isset( $import['options']['category_single'] )
&& is_array( $import['options']['category_single'] )
) {
?>
$values ) {
$cat = get_category( $key );
if ( ! count( $values ) ) { continue; }
list_sidebar_replacement( $cat->name, $values );
}
echo '
';
}
/**
* archive-category
*/
if (
isset( $import['options'] )
&& isset( $import['options']['category_archive'] )
&& is_array( $import['options']['category_archive'] )
) {
?>
$values ) {
$cat = get_category( $key );
if ( ! is_a( $cat, 'WP_Term' ) ) {
continue;
}
if ( ! count( $values ) ) {
continue;
}
list_sidebar_replacement( $cat->name, $values );
}
echo '
';
}
?>