Global Content Blocks
[resolved] Adding a filter for content block (4 posts)

  1. Jan Zikmund
    Posted 4 years ago #

    Hello Benz1,

    first thanks a lot for this awesome plugin, exactly what I need. There is just one enhancement I would really appreciate-

    Could you add a filter to the returned block before it is inserted into page? That way any plugin/template developer could adjust it anyway he needs, without need to modify your plugin. Something like this would be really cool:

    Line #186 in global-content-blocks.php, instead of

    if($record->type!="php") {
    return htmlspecialchars_decode(stripslashes($record->value));

    have this:

    if($record->type!="php") {
    return apply_filters('gcb_block_output', htmlspecialchars_decode(stripslashes($record->value)));

    .. and same for the PHP output on line #196.

    One of the reasons I need this is to use shortcodes even in the content blocks in your plugin. There were already requests for this here and here.

    If you added the filter I suggest, then this would be a piece of cake - you would just add this into your functions.php and all shortcodes in Global content blocks would be processed by the shortcode engine:

    add_filter('gcb_block_output', 'do_shortcode');

    Do you think you could implement this and release it with the new version ? I think a lot of people would appreciate it.

    Thanks and have a nice day.


  2. benz1
    Plugin Author

    Posted 4 years ago #

    Hi and thanks for the clear explanation. I've gone ahead and done this and will upload to the repository shortly but if you want to send me your email address via here I can send you the new version to test before I upload it.

  3. benz1
    Plugin Author

    Posted 4 years ago #

    FYI, the new version (1.4) of the plugin has been updated on the repository.

    Please feel free to give the plugin a rating at http://wordpress.org/extend/plugins/global-content-blocks/.


  4. Jan Zikmund
    Posted 4 years ago #

    Hello, thanks a lot, it's great that you can respond so fast.
    The new plugin version is working great, it's exactly what I wanted. I just rated it by five stars and I am sure I will use it again.

    Thanks and have a nice day

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic