Pods in Bricks

Updated on 3 Aug 2023

This Pro tutorial is going to be a collection of tips and code snippets for using/implementing Pods in Bricks builder.

Custom Settings Page fields

Creating a settings page
Sample setting page fields
Fields populated

How to output the value of a field in a settings page whether or not it is inside a group:


{echo:get_option( sitewide_phone )}

view raw

gistfile1.txt

hosted with ❤ by GitHub

where sitewide is the Pod name for the settings page and phone is the Name of the field.

URL (only applies to this particular case where the field is for storing the phone number):


tel:{echo:get_option( sitewide_phone )}

view raw

gistfile1.txt

hosted with ❤ by GitHub

Another example:


{echo:get_option( sitewide_twitter )}

view raw

gistfile1.txt

hosted with ❤ by GitHub

Note that even though twitter field is inside a group, we pulled its value the same way without specifying the group name. For front-end usage, there is no difference between regular fields and those inside groups. It is just a matter of grouping fields to organize your admin edit screens (source).

To get the value of a field from a Pods Settings page in a Code element:

<?php
echo get_option( 'sitewide_twitter' );
?>

Yes / No Field

A Pods field of the type “Yes / No” literally returns either Yes or No depending on whether the field is ticked or not.

So in conditions you should not test for 1 or 0, but instead Yes or No.

References

https://docs.pods.io/displaying-pods/displaying-custom-settings-pages/