Skip to content

Instantly share code, notes, and snippets.

View miclow's full-sized avatar

Michelle Low miclow

View GitHub Profile
@miclow
miclow / functions.php
Last active October 12, 2018 03:55
PHP set cookie (user_is_admin) when visitor access the admin of Wordpress
function my_exclude_admin_cookie() {
$expire_time = time() + 60 * 60 * 24 * 180;
setcookie( 'user_is_admin', 'true', $expire_time, '/' );
}
if( is_admin() ) {
add_action('init', 'my_exclude_admin_cookie');
}
@miclow
miclow / set-dimension.php
Created October 11, 2018 13:46
PHP set GA dimension when cookie (user_is_admin) exists
<?php
if( isset( $_COOKIE['user_is_admin'] ) ) {
echo 'ga(\'set\', \'dimension1\', \'true\');';
}
?>
@miclow
miclow / exclude-me-ga.php
Created October 11, 2018 13:43
PHP set cookie (user_is_admin) on page
<?php
$expire_time = time() + 60 * 60 * 24 * 180;
setcookie( 'user_is_admin', 'true', $expire_time, '/' );
?>
@miclow
miclow / gist:7cb0027e015a579f5372ae736f80c024
Last active May 10, 2016 02:38
Steps to push files to Git (Bitbucket) in Window
// 1) Create a repository in Bitbucket
// 2) Download Git for Window https://git-scm.com/download/win
// 3) Open Git Bash
// 4) Navigate to location of directory
$ cd /c/path/to/directory
// 5) Initialise Git directory