Skip Navigation

[Closed] Trying to display custom field within echo statement

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 9 years, 1 month 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
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqas 9 years, 1 month ago.

Assisted by: Waqas.

Author
Posts
#287715

I am trying to add a custom field within an echo statement (below):

echo '<div class="col-md-10 col-sm-10 col-xs-8">
     <h1>' . $imic_post_custom_title . '</h1>
</div>';

I tried

echo '<div class="col-md-10 col-sm-10 col-xs-8">
     <h1>' . types_render_field("bottom-overlay", array("output"=>"html")) . '</h1>
</div>';
#287828

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

You can do this by using one of the following codes:

echo '<div class="col-md-10 col-sm-10 col-xs-8">
     <h1>' . do_shortcode('[types field="my-custom-field-slug"][/types]') . '</h1>
</div>';

OR

echo '<div class="col-md-10 col-sm-10 col-xs-8">
     <h1>' . get_post_meta(get_the_ID(), 'my-custom-field-slug', true) . '</h1>
</div>';

Please see followings for more information:

- https://toolset.com/documentation/functions/
- http://codex.wordpress.org/Function_Reference/get_post_meta
- http://codex.wordpress.org/Function_Reference/do_shortcode

The topic ‘[Closed] Trying to display custom field within echo statement’ is closed to new replies.