[Résolu] Using content filter on Types fields causes issues with Video fields rendering
This support ticket is created Il y a 7 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I'm using a plugin called CM Tooltip Glossary which creates rollover glossary tooltips in your text content. It does this by hooking into the the main wordpress the_content filter.
The only way I could get this glossary tooltip plugin to recognise "glossary" terms that were in standard custom text fields set up in Types was to run all the Types fields through the main the_content filter like this in my functions.php:
It would appear that this is affecting the way the string is parsed to the Types function that renders the video, and thus the $args parameters are not being understood.
For example I've noticed in other places where this filter has been applied that the string that's stored in a standard types text field is being warpped in <p></p> tags when it's rendered using the types_render_field function.
I'm totally aware that this has taken us away from our initial problem, but I'm wondering if there's a way I can hook into an action in the Types plugin so that this filter is only applied to certain Types fields rather than ALL of them?
You need either an inclusive or an exclusive test for which field-slugs you want to apply the_content filter to.
Below I have assumed that you want to inclusively apply the_content filter to custom fields 'slug1', 'slug2', and 'slug3', and not leave other custom fields alone.