Skip Navigation

[Resolved] Display field inside another plugin in the Backend

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years ago.

Assisted by: Luo Yang.

Author
Posts
#1150679

Is there any documentation that you are following? Custom fields API

Is there a similar example that we can see? No

I have a PDF generator that generates PDF according to taxonomies, but i want it to be able to filter also by 2 fields assigned to a single CPT. These fields are selects.

The first part is to show the fields so we are able to implement the rest of the code.

In the PHP File:

$html .= '<div class="teste">';
echo types_render_field("wpfc-pais", array( ));
$html .= '</div>';

Returns blank in the Chrome Inspector (just the part of the php). Is there a way to implement this?

WARNING: This is in the backend, not the frontend.

Thank you

#1151091

Hello,

The Types function types_render_field is only available on the front end, not in the back end, which is probably why checking the function exists appears to fix the issue.

Rather than use types_render_field you can retrieve the custom field directly from wp_postmeta using wordpress built-in function get_post_meta():
https://developer.wordpress.org/reference/functions/get_post_meta/

Note that Types fields are stored with a prefix of 'wpcf-', so the correct key to use in get_post_meta would be 'wpcf-pais".

#1151242

Hi Luo,

I believe you miss interpreted what the question was, or perhaps i wasn't clear enough.

Postmeta retrieves the value of that field for a specific field.

This is what i want to see in the Backend: hidden link

A select filter.
Just the field itself so after that i can ask the developer to use that field so that it can retrieve CPT Listings based on that select and print them to PDF.

Where the field will appear, is not inside any post or any CPT related page.

Thanks

#1151716

Your screenshot isn't in English, is it a custom select field?
Are you going to populate the options of this select field with some dynamic data?

If it is, you can try to setup custom PHP codes, use filter hook "wpt_field_options" to trigger a custom PHP function, in this function, setup the select option values as what you want.

for example this thread:
https://toolset.com/forums/topic/dynamically-populate-the-a-dropdown-list-with-taxonomy-terms/