最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

twig - How to hide markup if shortcode returns no results? - Stack Overflow

programmeradmin2浏览0评论

I have MEC events plugin with shortcodes for different event categories entered into an ACF pro field, working fine. In the twig template I've tried:

{% if events.featured_events_shortcode is not empty %}
   <div id="featured" class="">
      {{ events.featured_events_shortcode | shortcodes  }}
   </div>
{% endif %}

But of course this checks if there is a shortcode, not whether the shortcode has any results, so what shows on screen is 'No event found!' instead I would rather not show the div if there are no events.

Any suggestions greatly appreciated!

发布评论

评论列表(0)

  1. 暂无评论