Support » Plugin: Recipe Cards For Your Food Blog from Zip Recipes » Filter to execute [shortcode] in recipe text fields

  • Dear Roger,

    thanks a lot for the work on this great plugin. I am working on the integration of a the rate-my-post plugin to work with zip recipe via functions.php. So far it works good, but I would like to execution a custom short in one of the text fields of zip recipe. Do you have a filter in mind, which I can use to add the WordPress do_shortcode action to enable execution of such short codes?

    PS.: Once it works, I am more than happy to share my solution here as well.

    Thanks in advance,

    Matthieu

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author RogierLankhorst

    (@rogierlankhorst)

    Hi @theschappy,

    Thanks, good to hear 🙂

    At this moment, there’s no filter, but I’ve taken a look and I think it should work by wrapping each string field into a do_shortcode() function. I’ve added this on a git branch.

    I’ve also added a filter to use. Can you try if this works for you? I’ve added it on github:

    https://github.com/rlankhorst/zip-recipes-free/tree/execute-shortcodes-in-text-fields

    As the node_modules folder is very big, and only needed for compiling gutenberg, you can delete it before uploading.

    If this works for you I’ll publish it in the next update.

    Hi Rogier,

    Thanks for creating the brach so quickly. It works partially wide a minor side effect. Once you click on the save button in the backend, the shortcode will be evaluated and gots replaced by the actual content also in the form and stored as html code in the database. The do_shortcode function should only be executed for content to be displaying in the frontend

    Thus, I would remove it from load function of models/Recipe.php. I discovered there is the filter zrdn_field_value called for all values loaded from the database, would be great to have approach for values to be displayed in the frontend. For example, applying a filter on the ready-to-render content after getting the content from calling Util::view(‘recipe’, $viewParams) at the end of function zrdn_format_recipe in class.ziprecipes.php.

    Cheers,

    Matthieu

    Plugin Author RogierLankhorst

    (@rogierlankhorst)

    Yes, you’re right of course. I have moved it to the zrdn_format_recipe function, and added another filter there as well. This should execute any shortcodes, and offers the option to use the filter “zrdn_recipe_content”

    Let me know if this helps! (same git branche)

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.