Skip to content

Instantly share code, notes, and snippets.

@traversal
Created November 5, 2014 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save traversal/6a13e7786d168d7588db to your computer and use it in GitHub Desktop.
Save traversal/6a13e7786d168d7588db to your computer and use it in GitHub Desktop.
Dedupe Workaround
<?php
// -- in functions.php
// --- Suppose you want to dedupe by a "first_name" field in a "bio" set
class MY_Post extends MEOW_Post {
function bio_firstname() {
return $this->bio->first_name();
}
}
// --- Now in you template code you should be able to do this:
// -- assumes you have a post type named person
foreach ($wf->type("person")->posts->dedupe("bio_firstname") as $person) {
// do something here
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment