Code Snippets

Collections of all of our Hook & Filters, Pods Templates and Template Examples

Date Format Output Filter for Magic Tags

Posted in , ,

Provide different date format options to your date fields using an Output Filter for your Magic Tag.

Override Field Description with pods_form_ui_comment_text Filter

Posted in , ,

add_filter( 'pods_form_ui_comment_text', 'gnt_pod_field_comment', 10, 3); function gnt_pod_field_comment($message, $name, $options) { $key = $options['pod'] .'.'. $options['name'] .'.description'; //TODO: lookup in file or db or stg if ('accel_feedback.aggregate_wellbeing.description' == $key) { $message = "<b>Normal = 0.00</b>. A zero value indicates that the student is generally positive<br/>". "<b><font …

Read more

How to Replace the More Fields Meta Box Title

Posted in , ,

Replacing “More Fields” for the Pods Meta Box

Update Post Title with values from other Fields and Make Post Title Uneditable

Posted in , ,

This example includes an override for the post title being created by other custom fields and also adds a filter to save that change on update.

Custom Settings Page Output Using Pods API

Posted in ,

<?php ​ /* place the following code in functions.php */ ​ function get_company_details() { $pod = pods('company_details'); ​ $fields = array( 'company_name' => $pod->field('company_name'), 'street_address' => $pod->field('street_address'), 'city' => $pod->field('city'), 'state' => $pod->field('state'), 'postal_code' => $pod->field('postal_code'), 'telephone' => $pod->field('telephone') ); ​ return $fields; } ​ …

Read more

Force get_post_meta to Return an ID and not an Array for Image Fields

Posted in , , , ,

There are situations where you need to have get_post_meta return just the ID and not an array of Image ID’s from your image fields. The addition of pods_no_conflict_on(‘post-type’) will correct the behavior of this function call.

Displaying Custom Settings with get_option

Posted in , ,

/* In this example my_custom_settings is the Custom Settings Page my_option is the field within that pod. You combine the two with an underscore to display them with get_option */ $my_option = get_option( 'my_custom_settings_my_option' );