Based upon this:
resolved post
I'm stuck at the same problem, but my meta value starts with a currency sign. However, substring helped in this case, but now I encounter another problem -> the value in the meta_key is written like: $2.000 !
Using this
<?php
// Define the function that will create the join string
function mam_custom_field_range($keyname='',$min=false,$max=false) {
global $mam_global_join,$wpdb;
if ($keyname && ($min !== false || $max !== false)) {
$mam_global_join =
" JOIN $wpdb->postmeta acfr_$keyname ON
( $wpdb->posts.ID = acfr_$keyname.post_id
AND acfr_$keyname.meta_key = '$keyname'";
if ($min !== false) $mam_global_join .= " AND acfr_$keyname.meta_value >= $min";
if ($max !== false) $mam_global_join .= " AND acfr_$keyname.meta_value <= $max";
$mam_global_join .= ')';
}
}
// Define the join filter function
function mam_posts_join ($join) {
global $mam_global_join;
if ($mam_global_join) $join .= $mam_global_join;
return $join;
}
// Add the filter to the hooks
add_filter('posts_join','mam_posts_join');
?>
The query treats 2.000 as 2... how do I solve this ?
thanks in advance...