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
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
Thanks for the reply & information. It sounds like I need to find another solution to this problem.
Marcus