Override Field Description with pods_form_ui_comment_text Filter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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 color='red'>Distress = -2.00</font></b>. Negative values indicate that the student is in distress<br/>". "<b><font color='green'>Excess = +2.00</font></b>. Positive values indicate high wellbeing or excessive ease.<br/>"; } return $message; } |
And how this looks on the end screen: Contributed by: TysonIt
Custom Settings Page Output Using Pods API
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?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; } ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<?php /* place the following code in {@template-name}.php or any wordpress template file */ $company_details = get_company_details(); ?> <div id="company-details" itemscope itemtype="http://schema.org/LocalBusiness"> <h1 id="company_name" itemprop="name"><?php echo $company_details['company_name']; ?></h1> <address itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <span id="street_address" itemprop="streetAddress"><?php echo $company_details['street_address']; ?></span> <span id="city" itemprop="addressLocality"><?php echo $company_details['city']; ?></span>, <span id="state" itemprop="addressRegion"><?php echo $company_details['state']; ?></span> <span id="postal_code" itemprop="postalCode"><?php echo $company_details['postal_code']; ?></span> </address> <span id="telephone" itemprop="telephone"><?php echo $company_details['telephone']; ?></span> </div> |
Force get_post_meta to Return an ID and not an Array for Image Fields
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
1 2 3 4 5 6 7 |
/* 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' ); |
- « Previous
- 1
- …
- 4
- 5
- 6