Skip to content

Instantly share code, notes, and snippets.

View alicolville's full-sized avatar

Ali Colville alicolville

View GitHub Profile
@alicolville
alicolville / gist:0e7a5fcd0e427ecfdb486be9bc1c09ea
Created July 10, 2019 08:50
Change Weight Tracker measurement titles
/**
* Rename some of the measurement fields
*
* @param $supported_measurements
*
* @return mixed
*/
function yk_docfit_filter_measurements( $supported_measurements ) {
$supported_measurements[ 'navel' ][ 'title' ] = 'Bellybutton';
/*
Below is an example (not the best one) but an example none the less!
*/
[wt-if field="is-logged-in"]
Great you're logged in...
[wt-if-1 field="height"]
... and you have added a height.
@alicolville
alicolville / [wlt-if]
Last active March 22, 2021 21:27
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]
@alicolville
alicolville / gist:be4ab064dbd4d0a723ecd75649831e45
Last active March 23, 2021 20:13
Macronutrients Shortcodes
[wt-macronutrients-table]
<!-- Maintain -->
[wt-macronutrients progress="maintain" type="total" nutrient="protein"]
[wt-macronutrients progress="maintain" type="total" nutrient="carbs"]
[wt-macronutrients progress="maintain" type="total" nutrient="fats"]
[wt-macronutrients progress="maintain" type="breakfast" nutrient="protein"]
[wt-macronutrients progress="maintain" type="breakfast" nutrient="carbs"]
@alicolville
alicolville / example.php
Last active November 22, 2023 11:41
Example User ID lookup
<?php
// Set the user that you wish to load to one passed via qs, if not, default to logged in user id
$user_id = ( false === isset( $_GET[ 'user-id' ] ) ) ? (int) $_GET[ 'user-id' ] : get_current_user_id();
// Worth checking that the user we're trying to view exists
if ( false === get_userdata( $user_id ) ) {
// display error saying user doesn't exist
}