Sauter la navigation

[Résolu] How Do I Display Custom Fields using PHP for the backend template?

This support ticket is created Il y a 6 années et 4 mois. 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.

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par marcusC-4 Il y a 6 années et 4 mois.

Auteur
Publications
#1091475

I’m trying to find some documentation on how to use PHP to display the custom field options on the admin page. We have a custom template for the backend (instead of the default WP editor) and I need to use PHP to display my custom field input options on that edit screen.

I’ve looked around & found a lot of documentation on displaying the fields on the front-end, probably just missed the documentation on the backend, but if you can point me in the right direction, that would be great.

Thanks,

Marcus

#1091892

Toolset Types has an API to display any type of data anywhere you can execute PHP:
https://toolset.com/documentation/customizing-sites-using-php/functions/

However, using this in the backend is not the purpose of it.
Usually WordPress Plugins will display their data (the data you can manipulate) in the Front End, not in the backend.

It is not that the documentation is missing about, it's simply not intended to be used like that.

When using the Fields Render API in the backend, if you want to, you can, but need to know about this:
- Types is not loading the shortcode stuff on the backend as it’s only used on the frontend (normally).
- You would have to load the required files if you want to use the shortcode rendering (or function) on the backend:

function uvt_show_adsl() {
require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
return types_render_field('service-order', array('id' => '3883'));
}

add_shortcode('uvt_show_adsl', 'uvt_show_adsl');

The problem is that the file paths may change in future releases… So you can do it but kind of at your own management and risk.

Now, this is just abut display.

About edit, this is completely impossible, I mean, your template should simply allow Plugins to hook in their code, because if you want to "rebuild" the inputs of Types, you will basically rebuild Types itself

#1092253

Thanks for the reply & information. It sounds like I need to find another solution to this problem.

Marcus