Skip to content

Instantly share code, notes, and snippets.

@traversal
Created October 8, 2014 03:39
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/6684b050d013b68e8c6c to your computer and use it in GitHub Desktop.
Save traversal/6684b050d013b68e8c6c to your computer and use it in GitHub Desktop.
Getting an array of field set names
<?php
// assuming you have a post type "logo", here is the code to get an array of set names for that type.
<?php
echo "<h2>Logo Field Sets</h2>";
global $meow_provider;
$set_names = array();
$sets = $meow_provider->post_type_field_sets("logo");
foreach ($sets as $set) {
echo "<h1>Set:" . $set->name . "</h1>";
echo "<h2>Fields</h2>";
echo "<ul>";
foreach ($set->fields() as $field) {
echo "<li>". $field->display_label() . " (" . $field->name . ")</li>";
}
echo "</ul>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment