Support » Plugin: Content Blocks (Custom Post Widget) » Content Blocks introducing paragraph and break tags intermittently

  • Resolved ScottCodes

    (@scottlush)


    Thanks for the excellent plugin.

    Is there a way that we can turn off apply_filters( ‘the_content’, $content) for all Content Blocks?

    If we were adding Content Block shortcodes in a WIDGET we could use the built-in checkbox “Do not apply content filters”. But we are not. Instead we insert the Content Block shortcodes directly into posts and pages where there is no checkbox.

    The reason is that we are trying to avoid WordPress formatting Content Blocks with intermittent paragraph and break tags.

    • This topic was modified 7 months, 2 weeks ago by ScottCodes.
    • This topic was modified 7 months, 2 weeks ago by ScottCodes.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ScottCodes

    (@scottlush)

    We see where in post-widget.php line 176 you set
    'suppress_content_filters' => 'no',

    We wish we could set the default to
    'suppress_content_filters' => 'yes',

    ..but we don’t know how to do that without forking your plugin.

    Plugin Author Johan van der Wijk

    (@vanderwijk)

    Hi Scott, I am going to add the possibility of using a custom template for the shortcode (just like you can now to for the widget), would that help?

    Thread Starter ScottCodes

    (@scottlush)

    If a custom template can allow us to set this, then yes it would help ->
    'suppress_content_filters' => 'yes',

    The issue is that when we insert Content Block shortcodes into Posts and Pages, WordPress adds <p></p> and interprets some line breaks in the code as <p></p>. We spend almost as much time debugging these random line breaks as we do writing the html in the Content Blocks. We think that the cause is WordPress passing these blocks through apply_filters( ‘the_content’, ‘this_content_block’ ). Maybe not?

    Our workaround has been to minify all html in a Content Block. But then it is hard to read 🙂

    Thanks for following up!

    • This reply was modified 5 months, 1 week ago by ScottCodes.
    • This reply was modified 5 months, 1 week ago by ScottCodes.
    Plugin Author Johan van der Wijk

    (@vanderwijk)

    Okay, I think I have built what you need now.

    Would you be able to test this new version: https://github.com/vanderwijk/custom-post-widget/archive/master.zip

    You will have to copy the example template from example-templates/shortcode-template.php to your theme root folder and add template=”shortcode-template.php” to the shortcode you add to the editor.

    Please let me know if this works for you!

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