Skip to content

Instantly share code, notes, and snippets.

@yekenuk yekenuk/[wlt-if]
Last active Sep 3, 2017

Embed
What would you like to do?
Examples of [wlt-if] shortcode
// ------------------------------------------
// Checking is logged in
// ------------------------------------------
[wlt-if field="is-logged-in"]
[wlt-chart]
[else]
You must log in to see your chart.
[/wlt-if]
// ------------------------------------------
// Checking for a weight entry
// ------------------------------------------
[wlt-if]
Current user has a weight entry.
[else]
Current user has no weight entries.
[/wlt-if]
[wlt-if field="weight"]
Current user has a weight entry.
[else]
Current user has no weight entries.
[/wlt-if]
[wlt-if field="weight" operator="not-exists"]
There is no weight entry for this user.
[else]
[wlt-chart]
[/wlt-if]
// ------------------------------------------
// Checking for target weight
// ------------------------------------------
[wlt-if user-id=110 field="target"]
Specified user has a target
[else]
Specified user has no target
[/wlt-if]
Display a progress bar if the user has a target:
[wlt-if field="target"]
[wlt-progress-bar]
[/wlt-if]
// ------------------------------------------
// Checking for BMR
// ------------------------------------------
[wlt-if field="bmr" operator="not-exists"]
Please complete all the user settings so we can calculate your BMR.
[else]
Your BMR is: [wlt-bmr]
Here is a suggested calorie intake guide:
[wlt-calories-table]
[/wlt-if]
// ------------------------------------------
// Checking for Height
// ------------------------------------------
[wlt-if field="height"]
Your height is: [wlt-height]
[/wlt-if]
[wlt-if field="height" operator="not-exists"]
Please enter your height - <a href="[some link]">Update your preferences</a>.
[/wlt-if]
// ------------------------------------------
// Checking for Activity Level
// ------------------------------------------
[wlt-if field="activity_level"]
Your activity level is set at: [wlt-activity-level]
[/wlt-if]
// ------------------------------------------
// Checking for Activity Level
// ------------------------------------------
[wlt-if field="activity_level"]
Your activity level is set at: [wlt-activity-level]
[/wlt-if]
// ------------------------------------------
// Checking for DoB
// ------------------------------------------
[wlt-if field="dob"]
Your activity level is set at: [wlt-dob]
[/wlt-if]
// ------------------------------------------
// Checking for Gender
// ------------------------------------------
[wlt-if field="gender"]
Your activity level is set at: [wlt-gender]
[/wlt-if]
// ------------------------------------------
// Multiple fields can be seperated with a comma. The following example states the person must have a height
// and recent weight
// ------------------------------------------
[wlt-if field="height,weight"]
Well done. You have a height and weight
[/wlt-if]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.