• Resolved doffine

    (@doffine)


    Hello there,

    we just met the problem that the plugin automatically adds a p tag around the content from the timed content shortcode. This cannot be a WordPress editor problem since other content added by other plugins/shortcodes don’t get a p around the content within the same page. How can we get rid of this auto p tag?

    Many greetings and thnaks for the great plugin,
    Matthias

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    The problem is not that the plugin adds a p tag. It actually may remove content which may leave empty lines. And those empty lines may result in orphan parargraphs or even single orphan p tags.

    However, with the latest WordPress versions I could not find an example where this happens. Do you have an example how to reproduce this?

    Thread Starter doffine

    (@doffine)

    Hi Arno,

    thank you very much for coming back to us.
    One way to reproduce the problem is to just use a blank, new WordPress 4.9.8 and set up a new page with the following content…

    <a href="https://www.www.ads-software.com">Test</a>[timed-content-server hide="2019-SEP-12 16:00:00 Europe/Berlin"]<a href="https://www.www.ads-software.com">www.ads-software.com</a>[/timed-content-server]<a href="https://www.www.ads-software.com">Test2</a>

    You will see a p around all three links. One could guess now that all p tags are produced by WordPress p adding automatic. But when you install a plugin like “Toggle wpautop”, “Disable WPautop”, “Remove Wpautop” or “Manage WPAutoP” and disable auto p, the p around first and third link disappears, but not the p around timed-content-link.

    Plugin Author Arno Welzel

    (@awelzel)

    Thanks for the example.

    To explain the result:

    WordPress passes the whole content inside the shortcode to the registered shortcode handler and the result of the shortcode handler will be used without without applying any filters at all.

    Therefore Timed Content needs to apply a number of filters on the content. Otherwise it would not be possible to embed other shortcodes or more complex content as content (galleries etc.).

    These filters are:

    • wptexturize
    • convert_smilies
    • convert_chars
    • wpautop
    • prepend_attachment
    • do_shortcode

    The result is, that you can show or hide whole page sections with Timed Content even if these sections other shortcodes like Galleries – but on the other hand it is not possible to show or hide just simple text inside a line or paragraph.

    I tried to remove the wpautop filter inside Timed Content and so far it looks OK, but I have to do further testing.

    If you want to try this out – comment out line 1502 in timed-content.php:

    Before:

    add_filter('timed_content_filter', 'wpautop');

    After:

    // add_filter('timed_content_filter', 'wpautop');

    This will remove the wpautop filter from the Timed Content handler and you should not get any extra p elements where you don’t expect them.

    Even though the results looks promising, I still have to do more tests before I’ll publish an update.

    Plugin Author Arno Welzel

    (@awelzel)

    According to https://codex.www.ads-software.com/Shortcode_API WordPress indeed applies wpautop and wptexturize before executing shortcodes – therefore applying these filters inside the shortcode handler of Timed Content should not be needed at all. I’ll fix this with the next update.

    Thread Starter doffine

    (@doffine)

    Hello Arno,

    well, this is perfect! Thank you for your versed reply… we are looking forward to the update. Until then we just passivated the p via additional CSS “display: inline”.

    Thanks again and many greetings!

    Plugin Author Arno Welzel

    (@awelzel)

    I just pushed an update (version 2.10) which should fix this problem.

    Thread Starter doffine

    (@doffine)

    Hi Arno,

    perfect – now it works without any additional ps. Thanks for your quick fix!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Auto p tag around [timed-content-server] Shortcode’ is closed to new replies.