Let's say I create a Single Line Field in Toolset > Post Fields, and I want to display this fields with PHP.
Then I use this:
echo (types_render_field( 'field-slug', array() ));
(Note that in the array() you can also pass a Post ID and more arguments as shown here: https://toolset.com/documentation/customizing-sites-using-php/functions/)
This will output the Field "field-slug" on the Single Post where I saved this Field.
I can also do that directly with the WordPress API:
echo (get_post_meta( $post->ID, "field-slug", false ));
This is how you display Custom Fields in WordPress, or Toolset, using PHP.
Can I ask, why you want to display them with PHP?
See, I am not allowed to provide Custom Code.
I can show you how to create custom code, can help to find the right approaches, review, but I cannot create the full custom code.
We created Toolset so people do not need to learn PHP.
That is why I feel bad in both cases:
- I provide you with a full custom code, which you will not understand and hence cannot fully control
- I do not provide it, but then you cannot move on.
This is why I explain how to use it, but if you need assistance with creating and maintaining your PHP custom code, I suggest to consult a Contractor:
https://toolset.com/contractors/
Now, if in the file where you add the "echo "I see this;" you see "I see this" on the front end, then the types_render_field or get_post_meta will also show, as long there are some values saved in that field for the current post.
I can, for example, add an "example custom field" to your Site, and then add a code to the PHP File to display that, so you can use that as an example.
I already have access to your site, but there I see only a Child theme active that has no Files included but the functions.php file.
If you are editing the Parent theme, I suggest that you instead add that file to the Child theme and edit it there, according to the WordPress Codex:
https://codex.wordpress.org/Child_Themes
If you can show me where you see "I see this" after inserting "echo "I see this";", I can add a call to an example Custom Field there, so you can use it as an example.
But I cannot suggest doing that in the parent theme.