Skip Navigation

[Closed] Displaying custom fields on posts

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 8 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Caridad 8 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#323847

I'm trying to display custom fields on all my posts using PHP. I know what code I need to add I just dont quite know where to add it. I have tried in my single.php and the content.php files of my child theme, but it hasn't worked. Its a very easy thing to do I just dont quite know where to put the code. The site im building is hidden link and its using the MH magazine lite theme.

I have read and understand this page https://toolset.com/documentation/user-guides/displaying-wordpress-custom-fields/#1
I just dont know exactly where the necessary code =(
Any and all the help will be greatly appreciated.

#324048

You need to edit (or create) the correct theme file so that the custom field is displayed only where you want it:

https://developer.wordpress.org/themes/basics/template-hierarchy/

You can find the code to display a custom field in the documentation you posted:

<?php
 
echo types_render_field("custom-field-slug-name", array("argument1"=>"value1","argument2"=>"value2","argument2"=>"value2"));
 
?>

Another solution is to use our Views plugin for this, it requires no coding:

https://toolset.com/home/views-create-elegant-displays-for-your-content/#purchase

The topic ‘[Closed] Displaying custom fields on posts’ is closed to new replies.