• Resolved JLBA

    (@jltest)


    Hi everyone,

    Plain text field outputs <p>…</p> html elements on the front office. How can I add a css class to this <p> element ?

    I’ve added a css class in the field’s Advanced options but I still get <p> instead of <p class=””>.

    In Pods’s template, I tried <p class=”myclass”>{@myfield}</p> but it doesn’t work.

    For now, I wrap {@mytextfield} with a <div class=”myclass”> so it outputs

    <div class="myclass">
    <p>My text</p>
    </div>

    Is there a better solution ?

    Thanks for your help.

    • This topic was modified 11 months, 2 weeks ago by JLBA.
    • This topic was modified 11 months, 2 weeks ago by JLBA.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter JLBA

    (@jltest)

    Oups. Of course, my template is :

    <div class="myclasse">
    {@mytextfield}
    </div>

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @jltest

    If it’s a simple text field you could try to disable wpautop function on thie field and wrap it yourself.

    If it’s a WYSIWYG field then I afraid it’s out of your control since WP core handles auto paragraphs.
    Of course you can filter the output manually so that would be an option.

    Why do you need the class on this exact item? Is a wrapper not sufficient for CSS selectors?

    Cheers, Jory

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add css class to plain text field in pods template ?’ is closed to new replies.