Recipe - Show Until, Show After Lava Shortcodes
Skill level: Beginner
Organization: West Side Christian Church
Requires Rock: 1.8.0
{# strip images & classes from the HTML but otherwise leave structure #}
Want a simple way to have content appear and disappear on your site?
Create this simple lava shortcode to have content that goes away when you tell it to.
Home > Admin Tools > CMS Configuration > Lava Shortcodes
Name: Show Until
Tag Name: showuntil
Tag Type: Block
Description:
Displays Content until a date time is reached.
Documentation:
Basic Usage:
{[showuntil datecode:'202004151200']}content{[endshowuntil]}
Shortcode Markup:
{% assign ts = 'Now' | Date:'yyyyMMddHHmm' | Plus:0 %}{% if ts < {{datecode}} %}content{% endif %}
Parameters:
Key: datecode
You can also create a opposite shortcode for to display content after a date and time is reached.
Name: Show After
Tag Name: showafter
Tag Type: Block
Description:
Displays Content after a date time is reached.
Documentation:
Basic Usage:
{[showafter datecode:'202004151200']}content{[endshowafter]}
Shortcode Markup:
{% assign ts = 'Now' | Date:'yyyyMMddHHmm' | Plus:0 %}{% if ts > {{datecode}} %}content{% endif %}
Parameters:
Key: datecode
Screenshots
- /GetImage.ashx?guid=01dc3daa-18bb-40a6-af77-736d9cbd0dc4