Quick Look
Enjoyable Queries
Custom WP_Query and get_posts queries suck. That rubbish is tucked away behind a fluid interface. You'll love it.
wpm('q.member')->get();
Simple Post Type Creation
Forget the plugins or drawn out function calls. How about this?
wpm('wp.post_type')->create([
'name' => 'Member'
]);
Build Taxonomies with Ease
Did I mention it was pretty easy?
wpm('wp.taxonomy')->create([
'name' => 'Skill',
'post_type' => 'member'
]);
Tough Stuff
Yeah, yeah. But what if I need to make a real query?
// All members that have design and development skills
wpm('q.member')->tax('skill', ['design', 'development'])->get();
// First member that has design or development skills
wpm('q.member')->tax('skill', 'in', ['design', 'development'])->first();
// All members that are not skilled in angular
wpm('q.member')->tax('skill', 'not', 'angular')->first();
// All members that have mad design skills and have the role of manager
// OR is just as cool because their role is Creative Director
wpm('q.member')->tax(function($wpm) {
return [
'relation' => 'and',
$wpm->taxQuery('skill', 'design'),
$wpm->taxQuery('role', 'manager'),
];
})
->orTax('skill', 'creative-director')
->get();
// All members who have just became eligible to vote and are employees
wpm('q.member')
->meta('age', 18)
->andMeta('status', 'employee')
->get();
// All members are eligible to vote and are employees
// OR are under 18 and interns
wpm('q.member')
->meta(function($wpm) {
return [
'relation' => 'AND',
$wpm->metaQuery('status', 'employee'),
$wpm->metaQuery('age', '>=', 18)
];
})->orMeta(function($wpm) {
return [
'relation' => 'AND',
$wpm->metaQuery('status', 'intern'),
$wpm->metaQuery('age', '<', 18)
];
})->get()