Add visibility option to player metrics

This commit is contained in:
Brian Miyaji
2017-06-25 09:41:55 +10:00
parent 83ebb9e81b
commit 8317be9c60
3 changed files with 45 additions and 2 deletions

View File

@@ -1067,7 +1067,7 @@ if ( !function_exists( 'sp_draft_or_post_title' ) ) {
}
if ( !function_exists( 'sp_get_var_labels' ) ) {
function sp_get_var_labels( $post_type, $neg = null ) {
function sp_get_var_labels( $post_type, $neg = null, $all = true ) {
$args = array(
'post_type' => $post_type,
'numberposts' => -1,
@@ -1076,6 +1076,21 @@ if ( !function_exists( 'sp_get_var_labels' ) ) {
'order' => 'ASC',
);
if ( ! $all ) {
$args['meta_query'] = array(
array(
'key' => 'sp_visible',
'value' => 1,
),
array(
'key' => 'sp_visible',
'value' => 1,
'compare' => 'NOT EXISTS',
),
'relation' => 'OR',
);
}
$vars = get_posts( $args );
$output = array();