Fix up presets

This commit is contained in:
Brian Miyaji
2014-01-04 22:29:59 +11:00
parent 997226195d
commit 23ccb653a6
24 changed files with 469 additions and 486 deletions

View File

@@ -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 ) {