• Resolved maryannk

    (@maryannkelley)


    In the for brackets I am trying to remove the paragraph tags with trim=”true” but it is having no effect. I want a list instead of a paragraph, and my li tags are creating the list but each list item is separated by a paragraph. Everything is all on one line, so I know it’s not WordPress automatically inserting a paragraph for a blank line, but I can’t get it removed. Am I misusing the trim tag?
    This is the shortcode I’m using:

    <ul>[for each="resource_category" link trim=" "]<li>[each link]</li>[loop type="post" count="-1"][field title-link][/loop][/for]
    </ul>

    The resulting code is:

    <ul>
    <li><a href="url-here">Category name</a></li>
    <p></p>
    <li><a href="url-here">Category name</a></li>
    <p></p>
    </ul>

    https://wordpress.org/plugins/custom-content-shortcode/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hello,

    The trim parameter only trims single characters, and can’t handle HTML tags. Even though the shortcode is all in one line, I think the auto-formatting is still adding <p> tags. The easiest solution is to enable the [raw] shortcode under Settings, and change the above code to something like this:

    [raw]
      [for each="resource_category"]
        [each link]<br>
        <ul>
          [loop type="post"]<li>[field title-link]</li>[/loop]
        </ul>
      [/for]
    [/raw]
    Thread Starter maryannk

    (@maryannkelley)

    That doesn’t seem to be working. 🙁

    Thread Starter maryannk

    (@maryannkelley)

    All I get is the opening and closing [raw] tags surrounding the list.

    Plugin Author Eliot Akira

    (@miyarakira)

    Have you enabled the [raw] shortcode under Settings?

    Thread Starter maryannk

    (@maryannkelley)

    Disregard – it’s working now. Maybe there was a delay in the setting propagating or something. Thanks!

    Plugin Author Eliot Akira

    (@miyarakira)

    OK, thanks for letting me know. I’m glad to hear it’s working. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘trim not removing p tags’ is closed to new replies.