• I have a complex notification template that I want to use, and I would like to be sure that line breaks in the template don’t get turned into <br> and <p> tags. The function that does this is wpautop().

    There are plugins out there that skip wpautop() when rendering posts, but this plugin processes all templates with it in ES_Common::es_process_template_body().

    Commenting out that one line does the trick, but I imagine I’m not the only one who would like to write the template with precision.

    1. Would this be a welcome addition?

    2. Would you rather this be handled in the general settings or per-campaign?

Viewing 3 replies - 1 through 3 (of 3 total)
  • vaksupport

    (@vaksupport)

    Hello,

    We’re sorry for not responding in a timely bound manner.

    Could you reply to us with your use case or requirements so that our developers can look into it?

    Thread Starter Andie Hunt

    (@agh1)

    Sorry if it wasn’t clear. The use case is that I have a template with rather complex HTML that includes line breaks, and I don’t want those line breaks to cause new paragraphs. The WordPress function wpautop() does that.

    When rendering posts on the site, a variety of plugins offer the ability to skip wpautop(). However, when preparing a mailing, the Email Subscribers & Newsletters plugin runs everything through wpautop(), as you can see here: https://plugins.trac.www.ads-software.com/browser/email-subscribers/tags/4.3.12/lite/includes/class-es-common.php#L50

    I’ve addressed this on the site I manage that has this need, but it’s by hacking your plugin to remove the one line. I’d like to do this in a way that will not require me to do this every time I update the plugin. I also think it would be a useful feature for others to be able to choose whether to process templates with wpautop().

    I’m offering to write a patch for the plugin, but first I wanted to be sure that having an option to skip wpautop() is something you’d approve in concept.

    Second, I wanted to know whether you’d prefer to have a separate setting for each campaign or to have it be a single setting for all campaigns.

    PLUS ONE!

    I only just started using the Email Subscribers & Newsletters plugin. I configured all dialogs to use Dutch language and started building a nice-but-simple html-template for email notifications. For this I use, of course, the ‘Text’ editor on the Edit Templates page; not the ‘Visual’ editor.

    The way html is used by email clients is frustrating enough, but it becomes worse by the fact that my carefully crafted code gets ‘paragraphed’. I find a lot of p opening and closing tags, also at places that do not make sense – but only when I look at the email messages generated (using the WP Mail Log plugin). I do not see these changes in the editor.

    As agh1 deftly suggested, I commented out the wpautop-call in line 50 of class-es-common.php plugin file. That solves the problem, which is fine, but it is of course not a good solution.

    I cannot understand how anybody can work with this; maybe I am missing something?

    Alternatively, is there a way to ‘import’ my templates in ES, so that I can use VS Code, Sublime Text etc., to prepare the templates and than transfer them, without any changes being made (!), to Email Subscribers?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Best way to skip wpautop on template’ is closed to new replies.