• Short code in post:
    [sc name="123" pros="<li>Great for video making</li>"]

    short code in shortcoder:

    <div class="pros"><h5>Pros:</h5>
          <ul>
            %%pros%%
          </ul>
        </div>

    HTML rendered:

    <div class="pros"><h5>Pros:</h5>
          <ul>
            </p>
    <li>Great for video making</li>
    </ul>
    </div>

    Why is the plugin adding in a useless </p> tag? It’s not valid HTML.

    • This topic was modified 3 years, 10 months ago by joshmacd.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author vaakash

    (@vaakash)

    Hi @joshmacd,

    That </p><p> is added by WordPress when the content is displayed on the front.

    WordPress adds <p> tag to automatically replace lines which have line breaks.

    In this case for some reason the parser add </p> before <li> and <p> after </li>.

    The immediate workaround would be to just disable this feature. Note that this may disable adding p tags on the front for older posts which has no p tags.

    https://stackoverflow.com/questions/22710524/stop-wordpress-automatically-showing-p-p-tags

    The other workaround is to simply not use HTML in shortcode parameters and use plain text and then use HTML in the shortcode content.

    I’ve added this to my todo list to over come this issue.
    I’ll work on this handle this in the next version.

    Thanks,
    Aakash

    • This reply was modified 3 years, 10 months ago by vaakash.
    Thread Starter joshmacd

    (@joshmacd)

    I think I have to use HTML because I’m trying to pass a list of texts and the lengths differ.

    I don’t think shortcoder has loops does it?

    Sometimes I’m passing

    word1,word2,word3

    or

    word1,word2

    so i put them in li tags when i send them

    is there a better way?

    Plugin Author vaakash

    (@vaakash)

    Hi @joshmacd,

    Sorry for the late reply.

    Yes, the content inside shortcode content cannot be programatically controlled. Using custom parameters is the way.

    I’ll try to handle this in the next version.

    Meantime can you please temporarily disable automatic addition of <p> tags ?

    https://stackoverflow.com/a/22710688/306961

    I’ll try to issue a fix by next weekend.

    Thanks,
    Aakash

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘plugin inserts p tag when using parameters’ is closed to new replies.