Support

Account

Home Forums Add-ons Flexible Content Field Snippet of HTML

Solved

Snippet of HTML

  • Hi guys,
    I am building a page template using several flexible content pieces. I need to add flexible content that is just a chunk of rendered html. The chunk of HTML would be a call to action button with predefined URL. It’s the same everywhere we put it.

    I would enter the code that I want to have show up in the front end. It might look like this:

    <a href="http://mylink.ca" class="mybuttonclass">Click to Apply</a>

    The key piece to this is when the user is building the page, they would not have any fields to enter information, they would simply add the element, drag it around if they want in the flexible content area, and it would show up where they want it.

    I can do this simply with a text field, and wrap the field in the button html, but the user would have to enter something in the text field for it to work.

    Any ideas how to do this?

    Thanks,
    Jamie

  • If this is part of a flex field you can add a layout that has no sub fields. Then there’s simply nothing to enter. Then do something like

    
    while(have_rows('flex_field')) {
      the_row();
      if (get_row_layout() == 'your_layout_name') {
        // echo special block of code here
      }
    }
    
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Snippet of HTML’ is closed to new replies.