Conditional CTA's wrapped in a div


#1

Hi,

I'm looking to make a conditional CTA that essentially has a cta with a div wrapped.

However, I'm looking to make it conditional. So the ability to add it to certain blogs and not on other.

I've spotted this:


and written this:

  <div class="footer-cta-block">
    {% if widget_data.cta_footer_text.body.value %}
    has value
      {% widget_block rich_text "cta_footer_text" overrideable=True, label='Footer Cta Area'  %}
        {% widget_attribute "html" %}
        {% end_widget_attribute %}
      {% end_widget_block %}
   {% endif %}
  </div>

but it results in the whole widget not showing in the editor and I'm not sure what approach to take to tackle this one.

Any recommendations would be greatly appreciated.

Many thanks


#2

Hi @rst88,

Just to make sure that we're on the same page, you're trying to hide the CTA on the page, but keep the widget in the page editor? Can you send me a link to the page you're working on in HubSpot so that I can take a closer look?