In Progress

Need a custom wordpress meta_query written

Hi have three custom fields called min_age, max_age and suitable_for_adults. suitable_for_adults is a boolean, the other two are integers but max_age can be left blank.

I have the below select element to choose a filter:

<select name="age">

<option value="all">All ages</option>

<option value="3-4" selected="">3-4 year olds</option>

<option value="5-7">5-7 year olds</option>

<option value="8+">8 +</option>

<option value="adults">Suitable for adults</option>

</select>

Which I will use with GET to get the chosen filter. I need a custom meta_query to filter out my results depending on the above. mix_age will always exist, but a product might not have a max_age set, a product will only have either max_age or suitable_for_adults set, or neither. So I need the below to work with all scenarios:

$age = sanitize_text_field($_GET["age"]);

if($age == '3-4' || $age == '5-7') {

$array = explode('-', $age);

$query->set( 'meta_query', array(

'relation' => 'AND',

array(

'key' => 'min_age',

'value' => $array[0],

'type' => 'numeric',

'compare' => '>=',

),

array(

'key' => 'max_age',

'value' => $array[1],

'type' => 'numeric',

'compare' => '<=',

)

));

} else if($age == '8+') {

$query->set( 'meta_query', array(

array(

'key' => 'min_age',

'value' => 8,

'type' => 'numeric',

'compare' => '>=',

)

));

} else if($age == 'adults') {

$query->set( 'meta_key', 'suitable_for_adults' );

$query->set( 'meta_value', true );

}

mix_age was meant to say min_age

Skills: PHP, WordPress

See more: i need some general TEMPLATE for landing page so i can use it for selling more items. Design must be responsive. Can use english, need custom word done on my wordpress site, need custom wordpress plugin, meta_query compare like, wordpress meta_query serialized array, meta_query wordpress, acf meta_query, wordpress meta_query value array, wordpress query meta_key not exists, wp_query meta_query, wordpress check if meta key exists, wordpress, wordpress plugin query custom database, need someone custom wordpress theme, need custom wordpress theme, custom wordpress post query, custom top posts query wordpress, need custom myspace layout ill pay, custom wordpress design maker, need helper wordpress

About the Employer:
( 3 reviews ) Pully, Switzerland

Project ID: #15331639

Awarded to:

justTry

Hi! I think the products selection criteria have to be precised further a little. For example it's not quite clear products having neither 'max_age' or 'suitable_for_adults', or not having 'max_age' but having "s More

$20 USD in 1 day
(148 Reviews)
5.9

16 freelancers are bidding on average $63 for this job

A2Design

Hello! We are A2 Design, a Russian-Canadian web development company. We have been working with WordPress (and its many plugins, like BuddyPress, WooCommerce etc.) for ages. Our latest WP projects: [login to view URL] More

$350 USD in 3 days
(107 Reviews)
8.6
tlchung

I can write the custom meta_query for you. Relevant Skills and Experience I am a skilled wordpress developer with over 8 years experience. Proposed Milestones $55 USD - write the meta-query

$55 USD in 2 days
(413 Reviews)
7.5
devikagupta

hello, i understand your requirements... please contact me or accept my bid so that we can discuss more and start soon... i m expert in this type of project... u can also see my portfolio... please, give me a chanc More

$30 USD in 0 days
(452 Reviews)
7.0
$25 USD in 1 day
(213 Reviews)
6.3
Nikiit31

Hi, I can start now and can write custom query, kindly initiate chat and share more details I have 6+ years of working experience with PHP, Wordpress, HTML, CSS, Photoshop, Graphic design etc. Give me one chance to More

$30 USD in 1 day
(55 Reviews)
5.6
superwanchiu

Hello. Nice to meet you. I just saw your description carefully. I have rich experience for wordpress and php. I can start immediately and i can satisfy you surely. I would like to discuss more about your project w More

$100 USD in 1 day
(43 Reviews)
5.4
amutinda

Hello there, Thank you for your project, i am a wordpress developer with alot of experience and can get your querries to work as per your expectation. Regards Relevant Skills and Experience Wordpress Proposed Milest More

$45 USD in 1 day
(63 Reviews)
5.4
webdroid01

Dear Client, Greetings!! We have few queries kindly ping us. Thanks for giving us the opportunity to bid over the requirement. As per your requirement, you would like to develop a Website. We would like to share More

$25 USD in 1 day
(15 Reviews)
5.0
originitsolution

Dear Sir, You have recently advertised for website developer. After reading the job description I am confident that I would be a perfect fit for this position as my experience and abilities precisely match your requir More

$25 USD in 1 day
(8 Reviews)
4.2
strawmedia

I have reviewed your requirements and completely understand it. I am an expert and professional in my field. I can develop your preconceived website consisting of your intended pages and features. Here are some of m More

$150 USD in 3 days
(4 Reviews)
3.4
shrikant9907

Hi There, I read your requirement and I can write that meta_query within a day for $40. I have 4 years WordPress experience. My Recent Work: [login to view URL] Relevant Skills and Experience WooCommerce, WordPres More

$40 USD in 1 day
(8 Reviews)
3.5
Mark98998

Hi, I have gone through your project description and I'm interested to work with you. I'm very passionate about my work and give good quality of work to client. Stay tuned, I'm still working on this proposal.

$35 USD in 1 day
(5 Reviews)
3.2
nareshmorweb

Hi, As per your given description, Need to customize the Wordpress Query. Le.t we discuss about it Relevant Skills and Experience I have a 5 year experience in Worpress website development. Proposed Milestones $30 US More

$30 USD in 1 day
(4 Reviews)
1.8
$25 USD in 1 day
(1 Review)
0.2
Web2growthhub

hello sir, i read you job description that you want to run custom query in your WordPress site . i can do this work very easily. so if you want to quick start on this please message me so that we can discuss More

$20 USD in 1 day
(0 Reviews)
0.0