Fix up presets
This commit is contained in:
@@ -388,19 +388,17 @@ if ( !function_exists( 'sp_get_var_labels' ) ) {
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
if ( $independent ):
|
||||
$args['meta_query'] = array(
|
||||
array(
|
||||
'key' => 'sp_equation',
|
||||
'value'=>''
|
||||
)
|
||||
);
|
||||
endif;
|
||||
|
||||
$vars = get_posts( $args );
|
||||
|
||||
$output = array();
|
||||
foreach ( $vars as $var ):
|
||||
if ( $independent ):
|
||||
$equation = get_post_meta( $var->ID, 'sp_equation', true );
|
||||
if ( $equation && $equation != '' ):
|
||||
continue;
|
||||
endif;
|
||||
endif;
|
||||
$output[ $var->post_name ] = $var->post_title;
|
||||
endforeach;
|
||||
|
||||
@@ -765,6 +763,30 @@ if ( !function_exists( 'sportspress_render_option_field' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( !function_exists( 'sp_get_eos_safe_slug' ) ) {
|
||||
function sp_get_eos_safe_slug( $title, $post_id = 'var' ) {
|
||||
|
||||
// String to lowercase
|
||||
$title = strtolower( $title );
|
||||
|
||||
// Replace all numbers with words
|
||||
$title = sp_numbers_to_words( $title );
|
||||
|
||||
// Remove all other non-alphabet characters
|
||||
$title = preg_replace( "/[^a-z]/", '', $title );
|
||||
|
||||
// Convert post ID to words if title is empty
|
||||
if ( $title == '' ):
|
||||
|
||||
$title = sp_numbers_to_words( $post_id );
|
||||
|
||||
endif;
|
||||
|
||||
return $title;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( !function_exists( 'sp_solve' ) ) {
|
||||
function sp_solve( $equation, $vars ) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user