WordPress.org

Support

Support » Plugins and Hacks » Global Content Blocks » [Resolved] [Plugin: Global Content Blocks] GCB stripping HTML tags?

[Resolved] [Plugin: Global Content Blocks] GCB stripping HTML tags?

  • This is a strange one and i haven’t done allot of testing yet, but i’ll be happy to do so if needed.

    example:
    <p>hello world</p>
    above works fine, but…
    <p>[global content block] hello world</p>
    ends up as…
    block content hello world</p>
    where the opening <p> is stripped.
    in this case the content block is plain text and set to ‘general’

    if enclose only the block in ‘p’ tags, it’s fine, but when i combine it with existing text it borks the code somehow, even though the code looks fine in the WYSIWYG and the HTML editor.

    LOVING this plugin though! very cool!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author benz1

    @benz1

    Sorry wp.man but I am unable to replicate this.

    The following html in a post
    <p>[contentblock id=50 img=form.png] hello world</p>

    where contentblock id=50 is “* This is a test *”

    creates the following output for me:
    * This is a test * hello world

    i think i might have misled you benz1 – the output on the rendered page is fine, it’s in the source code where the opening ‘p’ tag gets dumped, so the source looks like…
    content block hello world</p>
    i’ll do some testing and see if i can’t provide more detail…

    this appears to be wordpress/tiinymce issue – god i hate that editor!

    TinyMCE Advanced plugin helps a bit, but it’s still not retaining the opening <p>

    sorry for the bother

    Plugin Author benz1

    @benz1

    No problem. Can you add the opening <p> into the content block?

    not really an option since it will mess up the code in other places where the block is used.

    what i’m seeing though is this; if i insert a plain text (general) block on a line by itself, then view the source (with TinyMCE Advanced installed), the opening/closing ‘p’ tags are present. however when previewing/updating the page and then checking the source in the browser, they are both gone.

    and then, as previously mentioned, if i insert a block on the same line as existing text, the opening ‘p’ is AWOL when previewing. sometimes the source ends up in the browser source as…
    block hello world<p></p>
    sometimes just the closing tag is there.

    so i’m not really sure what is responsible for stripping the tags.
    what do you think?

    if i add anything before and after the block – even just a dot – then the tags are not stripped. so, apparently, TinyMCE and/or WP simply doesn’t “see” the blocks and so it strips the tags – this explains why only the opening tag is stripped if the content block is the first object on a line with other text. CKEditor produces the same results (i just tried it).

    could you try just putting a plain text block on its own line, as a paragraph, then save/preview the page and look at the source in your browser to see if the tags are there?

    Plugin Author benz1

    @benz1

    The stripping out of tags after you switch to visual mode or save/update is a WP/TinyMCE feature. In fact adding a period the same color as the background is one way to force it to retain a paragraph break.

    I’ve never seen and can’t replicate just one tag disappearing. Sorry but I don’t think this is a GCB issue. Maybe a conflict with another plugin?

    hi ben
    out of curiosity, what happens on your end if you put a plain text block on it’s own line in <p></p>, then view the source in your browser?

    Plugin Author benz1

    @benz1

    Not sure at which point you mean but I get as follows:

    In editor HTML mode:
    <p>[contentblock id=50 img=form.png]</p>

    After switching to Visual mode and back to HTML:
    [contentblock id=50 img=form.png]

    Page source when previewed:
    * This is a test *

    Page source when previewed straight from HTML mode without switching to Visual mode:
    * This is a test *

    Page source after being published straight from HTML mode without switching to Visual mode:
    * This is a test *

    Page source after being published from Visual mode without switching to Visual mode:
    * This is a test *

    In every case, after switching to Visual mode, previewing or publishing, both opening and closing <p> tags are stripped out.

    ok, thanks
    sorry for the bother. knowing the limitations, i’ll adjust accordingly 🙂
    again, great plugin!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] [Plugin: Global Content Blocks] GCB stripping HTML tags?’ is closed to new replies.
Skip to toolbar