Binders: condition

TODO:

 

/**
 * Renders a block of text based on the provided condition.
 * 
 * 
 * @example 
 *
 * 
 * # 1: Show only on product page.
 * 
 * {{condition key="{{$post.post_name}}" operation="equal" value="product"}}
 * 	<p>This is the product page!</>
 * {{/condition}}
 *
 *
 * # 2: Show on every page but product.
 * 
 * {{condition key="{{$post.post_name}}" operation="not" value="product"}}
 * 	<p>This is not the product page!</>
 * {{/condition}}
 *
 * 
 * # 3: Show if matching a regex.
 * 
 * {{condition key="{{$post.post_permalink}}" operation="match" value="/free/"}}
 * 	<p>This promotion will expire soon!</p>
 * {{/condition}}
 *
 * 
 * # 4: Show on certain date.
 * 
 * {{condition key="{{date format='Y-m-d'}}" operation="match" value="2017-02-28"}}
 * 	<p>Today is the date!</p>
 * {{/condition}}
 *
 * 
 * # 5: Show after certain date.
 * 
 * {{condition key="{{date format='Y-m-d'}}" operation=">" value="2017-02-28"}}
 * 	<p>Sorry, you missed it :-(</p>
 * {{/condition}}
 *
 *
 */

 

Leave a Reply

Your email address will not be published. Required fields are marked *