Posted on July 3 - 2021 in

How to use Pods fields in WordPress Templates

I am currently working on a website for a client and for the first time, I have been working with Pods.

Usually I use Advanced Custom Fields, and to be honest if the choice was mine, I would continue to use them, but sometimes thats the way things are with clients…

The good news is they are also pretty simple to use. If you want to display data in a WordPress Template file, you can simply call the value by using the following bit of code:

the_field('field-name');

wrap that in PHP tags and you are good to go.

One field type that caused me a lot of headaches however were image based fields. Using the above code pulled back a huge array of all different data including the URL of the image. For the template I was building I only wanted the URL.

After hours of trawling Google I finally found the solution! You simply need to tac ‘.guid’ on the end and it will return only the URL of the image that has been uploaded for that field.

the_field('photo.guid');

 

Start your project

If you feel I can help you with web design project I'd love to hear from you. Getting started is as easy as dropping me an email to start the discussion.

Start Project