Add the following to the top of your root file:
require_once('device_detect.php');
$mobile_detect = new MobileDetect;
if ($mobile_detect->isMobile()) { echo 'Mobile!'; }
#!/bin/bash | |
# Set Timestamp | |
time_stamp=$(date +%Y-%m-%d) | |
# Create Backup Directory | |
mkdir /backups/$time_stamp | |
# Backup Database | |
mysqldump -u root --password=DB_PASS --all-databases | gzip > /PATH/TO/SQL_DUMP.sql.gz |
find ~/public_html -type d -exec chmod 755 {} \; | |
find ~/public_html -type f -exec chmod 644 {} \; |
UPDATE TBL_NAME SET COL_NAME = (CASE WHEN (COL_NAME = 0) THEN 1 ELSE 0 end); |
<?php | |
public function sort_by_key($key, $array, $sort_by) { | |
for ($i = 0; $i <= count($array) - 1; $i++) { | |
if (is_object($array[$i])) { | |
$array_item = $array[$i]->{$key}; | |
} else { | |
$array_item = $array[$i][$key]; | |
} | |
$sort[$i] = (isset($array_item)) ? strtolower($array_item) : ''; |
[alias] | |
report = "log --author=AUTHOR --since='2 sunday ago' --until='1 sunday ago' --format='%Cgreen%ci%Creset %s%Creset' --no-merges" |
<?php | |
function guidv4() | |
{ | |
$data = openssl_random_pseudo_bytes(16); | |
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0010 | |
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 | |
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); | |
} |
/* WooCommerce */ | |
// Products per page | |
function woocommerce_catalog_page_ordering() | |
{ ?> | |
<form action="/shop" method="POST" name="results"> | |
<select name="woocommerce-sort-by-columns" id="woocommerce-sort-by-columns" class="sortby" onchange="this.form.submit()"> | |
<?php | |
$shopCatalog_orderby = apply_filters('woocommerce_sortby_page', array( | |
'' => __('Results per page', 'woocommerce'), |