Skip to content

Instantly share code, notes, and snippets.

View alicolville's full-sized avatar

Ali Colville alicolville

View GitHub Profile
{"0":{"title":"Pounds Only","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"number","id":1,"label":"Your weight in pounds","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","inputs":null,"numberFormat":"decimal_dot","formId":3,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"wlt-pounds","inputName":"","visibility":"visible","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"rangeMin":"1","rangeMax":"400","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":""},{"type":"date","id":2,"label":"Date of entry","adminLabel":"","isRequired":true,"size":"medium","err
@alicolville
alicolville / gist:acbcb1d91f889c65963f7099db784299
Last active March 28, 2019 09:30
A snippet of code for replacing certain Weight Tracker words
/**
* Filter default WordPress translate functions to look for key Weight Tracker words and replace.
*
* @param $translation
* @param $text
* @param $domain
*
* @return string
*/
function wl_ls_cust_replace_words( $translation, $text, $domain ) {
<!-- -------------------------------------------------- -->
<!-- Firstname and Last name examples -->
<!-- -------------------------------------------------- -->
[cs-if conditions="firstname"]
First name exists
[/cs-if]
[cs-if conditions="firstname" operator="not-exists"]
First name does not exist
@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';
@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
}