Support

Account

Home Forums General Issues Wrapping html code around a field

Solving

Wrapping html code around a field

  • Hi.

    I’d like to add a simple ACF text field to a page but would I would like to wrap some custom code (a div with class element) around this text field, is this possible – example below.

    <div class="large-text">
    content of the ACF text field would be place here
    </div> 

    I’d like to add this code to the ACF field rather than in my page template as I’d like to use the flexible field, letting the user build the page in blocks.

    Many thanks for any help,
    Tony

  • <div class="large-text">
    <?php the_field('field_name'); ?>
    </div>

    or did i get your question all wrong 🙂

  • Hi Herka.

    Thank you for replying but yes, you did get the question wrong 😉

    It’s the code for the div that I wanted to ‘wrap’ around the custom field.

    I wanted to have a series of text boxes the user could choose from using the flexible content field, each with a different div/class code invisibly wrapped around the chosen field.

    Thank you for answering though, I do appreciate it.

    Regards,
    Tony

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Wrapping html code around a field’ is closed to new replies.