2

I downloaded the PODS 2 plugin (amazing!) - added a field to existing content type and now I would like to print it using php inside a widget. However I am not sure how to print the fields using pods - I tried to initialize it, but it is not working. Please see my code below. Any ideas?

<?php $mypod = pods( 'my_pod' );
 $mypod->display( 'my_field' ); ?>

http://staging.pods.io/docs/code/pods/

2

display does not echo, so you need to echo it.

<?php echo $mypod->display( 'my_field' ); ?>

More info and examples at http://staging.pods.io/docs/code/pods/display/

Also you will need to specify an ID of the item you want the field from in the pods() call, like:

<?php $mypod = pods( 'my_pod', $id ); ?>

Or use a find() call to get the record you want. http://staging.pods.io/docs/code/pods/find/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.