0

I'm using the plugin Ajax WP Query Search Filter (http://wordpress.org/plugins/ajax-wp-query-search-filter/) to search some custom posts I've created.

The filter works great on three custom taxonomies, however I also want to include a filter on a date field where the full date is stored.

The filter I'd like is a dropdown containing each month, as such:

  • Jan
  • Feb
  • Mar
  • Apr
  • May
  • ... etc...

This would search the date field on its month value. My question is how do I do this?

  • dd/mm/yyyy

I know I can create a Custom Meta Field filter, but how I would get it to search on the month part only?

Thanks,

Chris.

2
  • If I'm not wrong, are you trying to get the month from a date formatted in dd/mm/yyyy, is it right?
    – iEmanuele
    Sep 8 '13 at 22:51
  • The actual MySQL data is stored in yyyy/mm/dd format. We're showing the date front-end in dd/mm/yyyy (UK) format, but that doesn't matter really. What we're trying to do is use filter the month value from a dropdown menu, using the Ajax WP Query Search filter plugin.
    – pixelkicks
    Sep 9 '13 at 7:11
0

I've solved it by creating a Custom Meta Field filter using the following options:

-01-::Jan|-02::Feb|-03-::Mar|-04-::Apr|-05-::May|-06-::Jun|-07-::Jul|-08-::Aug|-09-::Sep|-10-::Oct|-11-::Nov|-12-::Dec

The "-mm-" in each part matches the month stored in the database. Pretty simple really but this works perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.