WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom post type named companies. When you add a new company you need to check if it's a leader or not, so I created custom metabox with two radios, one for "yes" and another for "no".

In the front page I'm filtering leaders just fine with a custom query.
I want to filter in the companies archive too. I want to add two links, "Leaders" and "New", so when you press "new" you basically filter by date and when you click "leaders" it filters by "yes".

I know I could do this with taxonomies, tags, categories etc...But for the client it'll be simpler to just say "yes" or "no".

So my question is, how can I implement custom metabox queries when you click a link? Should I use ajax for this? Oh, and there are a lot of companies so I'll need pagination too, probably using the wp_pagenavi plugin.

share|improve this question
if you create some taxonomies that should solve ur problems... – andresmijares25 Dec 15 '11 at 2:46
Yeah, I know, but the problem is that clients might be able to add more taxonomies that do nothing and they may misspell the correct ones, even though they can choose from the most used...This is oriented towards a clients that has no idea of Wordpress and has never used it before. – elclanrs Dec 15 '11 at 2:59

Something like this:

Make an URL like /companies/?leaders

Than in your archive template (top):

if(isset($_GET['leaders'])) {
   global $query_string;
   $query_string = $query_string . '&meta_key=leaders&meta_value=yes';

Hope this helps.

share|improve this answer
I don't quite understand what you mean... How do I create a new url if there are no taxonomies? – elclanrs Dec 15 '11 at 3:02
My bad, didn't understand your question correct. You can make a pagetemplate and then query for the meta key + meta value, right? – Rob Vermeer Dec 15 '11 at 3:12
Any other ideas? I guess I'll have to use ajax somehow... – elclanrs Dec 15 '11 at 3:13
Oh, I didn;t think about creating a page template, it may work...I'll try. – elclanrs Dec 15 '11 at 3:14
Paginate also works with page templates, but i guess you will have to make your own paginate links (codex.wordpress.org/Function_Reference/paginate_links). – Rob Vermeer Dec 15 '11 at 3:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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