Skip to content

Instantly share code, notes, and snippets.

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