This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# CWP - Custom backup script | |
# Modified for external Amazon S3 buckets | |
# based on a backup script by ejsolutions/Teo/cynique | |
# | |
# set cron job with something like: 0 4 * * * /backups-s3.sh > /dev/null 2>&1 | |
# | |
# Set the following 3 items to suit | |
tmp_dir=/home/backups_tmp/ | |
s3_bucket=freshlondon-backups-singapore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp', 'remove_lightbox', 99 ); | |
function remove_lightbox() { | |
remove_theme_support( 'wc-product-gallery-lightbox' ); // removes photoswipe markup on frontend | |
} | |
// disable flexslider js | |
function flex_dequeue_script() { | |
wp_dequeue_script( 'flexslider' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fl_archive_cats() { | |
$args = array( 'taxonomy' => 'katagori' ); | |
$categories = get_categories( $args ); | |
?> | |
<div class="fl-archive-cats"> | |
<?php | |
foreach ( $categories as $category ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# CWP - Custom backup script | |
# Modified for external Amazon S3 buckets | |
# based on a backup script by ejsolutions/Teo/cynique | |
# | |
# Set the following 3 items to suit | |
tmp_dir=/home/backups_tmp/ | |
s3_bucket=YOUR-BUCKET-NAME-HERE | |
retention=1 | |
# ------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toREM (size = 1) { | |
let winWidth = jQuery(window).width(); | |
if (winWidth <= 991) { | |
//base font size at 750px is 22px. | |
let baseFontSizeSmall = 29.1; | |
let winPercentSmall = winWidth / 991; | |
let fontSizeSmallFinal = window.finalFont = (baseFontSizeSmall * winPercentSmall); | |
return size / fontSizeSmallFinal; | |
} else { | |
//base font size at 1920px is 16px. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// I'd like to see whether the task row is odd or even in CSS for printing | |
// as for PHP DomPDF I cant use pseudo classes (:nth-child(odd)) | |
// get the tasks | |
$tasks = json_decode(get_post_meta($post->ID, 'tasks', true), true); | |
// set an evenm starting point, eg 0 | |
$row_oddEven = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Check whether a number is odd or even. | |
if (!function_exists('checkOddEven')) { | |
function checkOddEven($number){ | |
if($number % 2 == 0){ | |
echo "Even"; | |
} | |
else{ | |
echo "Odd"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!is_woocommerce() && !is_cart() && !is_checkout()) { | |
remove_action('wp_enqueue_scripts', [WC_Frontend_Scripts::class, 'load_scripts']); | |
remove_action('wp_print_scripts', [WC_Frontend_Scripts::class, 'localize_printed_scripts'], 5); | |
remove_action('wp_print_footer_scripts', [WC_Frontend_Scripts::class, 'localize_printed_scripts'], 5); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// Here's a usage example how to use this function for dynamicaly created CSS | |
$color = '#ffa226'; | |
$rgb = hex2rgba($color); | |
$rgba = hex2rgba($color, 0.7); | |
// CSS output | |
echo ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/* Convert hexdec color string to rgb(a) string */ | |
function hex2rgba($color, $opacity = false) { | |
$default = 'rgb(0,0,0)'; | |
//Return default if no color provided | |
if (empty($color)) return $default; | |
//Sanitize $color if "#" is provided |
NewerOlder