This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wf; | |
// suppose you have a post of type "family", slug "smith-family", with field set "details", and field "education_levels" | |
$selections = $wf->family( "smith-family" )->details->education_levels->selections(); | |
// $selections is now a value-label pair of the current selections. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'meta_query' => array( | |
array( | |
'key' => 'fields.type', | |
'value' => 'bnb', | |
'compare' => '=', | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to functions.php | |
function mp_template_change() { | |
echo "<script>jQuery( function($) { $('#mp-attributes select[name=page_template]').change(); } );</script>"; | |
} | |
add_filter("admin_head", "mp_template_change"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<?php | |
// Requires gmaps.js from GitHub: | |
// http://hpneo.github.io/gmaps/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_update_media($object_id, $object_type) { | |
global $wf; | |
if ($object_type == "post") { | |
$post = $wf->post($object_id); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// place this inside functions.php | |
function my_function() { | |
global $wf; | |
// should be able to loop over post types, for example | |
foreach ( $wf->post_types as $pt ) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<?php foreach ($wf->type("production")->by("production_deadline_fields.deadline_date", "DESC") as $production) : ?> | |
<li> | |
<h2>Production: <?= $production->title ?></h2> | |
<p> | |
Date: <?= $production->production_deadline_fields->deadline_date ?> | |
</p> | |
</li> | |
<?php endforeach; ?> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this method to MPFT_CheckboxList | |
// this returns an associative array of the selections, with keys being the checkbox values, values being the labels. | |
function selections() { | |
if (!isset($this->_tv)) { | |
$options = $this->field()->info->type_options; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
NewerOlder