Skip to content

Instantly share code, notes, and snippets.

View fieldoffice's full-sized avatar
🚲
Out cycling

Andy Field fieldoffice

🚲
Out cycling
View GitHub Profile
@fieldoffice
fieldoffice / default-mixins.scss
Last active August 20, 2021 11:52
Default SASS Mixins
/* MIXINS ___________________________________________*/
// Transitions
@mixin transition($transition-property, $transition-time, $method) {
-webkit-transition: $transition-property $transition-time $method;
-moz-transition: $transition-property $transition-time $method;
-ms-transition: $transition-property $transition-time $method;
transition: $transition-property $transition-time $method;
}
@fieldoffice
fieldoffice / toggle-if-checked.js
Created March 22, 2017 16:33
Toggle if checked
$('.checkbox').click(function(){
$('.content').slideToggle(this.checked);
});
@fieldoffice
fieldoffice / acf-repeater-if-else.php
Created January 19, 2017 19:14
acf-repeater-if-else
<?php
$service_link = get_sub_field('service_link');
$service_title = get_sub_field('service_title');
if( $service_link != '' ){ ?>
<a href="<?php echo $service_link; ?>" title="<?php echo $service_title; ?>"><?php echo $service_title; ?></a>
<?php } else { ?>
@fieldoffice
fieldoffice / uppercase-to-lowercase
Created January 16, 2017 13:48
Lowercase all file names - Terminal
$ for f in *; do mv "$f" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done
@fieldoffice
fieldoffice / woocoomerce-add-connection-fee.php
Created January 14, 2017 10:42
WooCommerce - Add Connection Fee
//CONNECTION FEES
function add_connection_fee( $cart_object ) {
global $woocommerce;
$specialfeecat = 17; // category id for the special fee
$spfee = 0.00; // initialize special fee
$spfeeperprod = 9.99; //special fee per product
foreach ( $cart_object->cart_contents as $key => $value ) {
@fieldoffice
fieldoffice / wp-list-table.php
Created December 25, 2016 21:10
WordPress Admin Screen using WP_List_Table
<?php
if(is_admin()) { new wp_topups(); }
class wp_topups {
public function __construct() {
add_action( 'admin_menu', array($this, 'add_menu_example_list_table_page' ));
}
public function add_menu_example_list_table_page() {
add_menu_page( 'Account Top Ups', 'Account Top Ups', 'manage_options', basename(__FILE__), array($this, 'list_table_page'), 'dashicons-chart-bar', '4' );
}
@fieldoffice
fieldoffice / uk-area-codes
Created December 10, 2016 15:41
UK Area Codes
0113 Leeds Numbers
0114 Sheffield Numbers
0115 Nottingham Numbers
0116 Leicester Numbers
0117 Bristol Numbers
0118 Reading Numbers
01200 Clitheroe Numbers
01202 Bournemouth Numbers
01204 Bolton Numbers
01205 Boston Numbers
/* TABS */
$('.tab-panel').hide();
$('.tab-panel:first').show();
$('.tabs li:first').addClass('active');
$('.tabs li a').click(function(){
$('.tabs li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
$('.tab-panel').fadeOut(200);
@fieldoffice
fieldoffice / wordpress-maintenance-mode
Last active January 10, 2021 21:49
Activate WordPress Maintenance Mode
// Activate WordPress Maintenance Mode
function wp_maintenance_mode(){
if(!current_user_can('edit_themes') || !is_user_logged_in()){
wp_die('<h1 style="color:red">Website under Maintenance</h1><br />We are performing scheduled maintenance. We will be back on-line shortly!');
}
}
add_action('get_header', 'wp_maintenance_mode');
@fieldoffice
fieldoffice / wordpress-config-options
Last active September 17, 2016 10:29
Additional WordPress Config Options
.htaccess
/*
Disable ETags
*/
Header unset ETag
FileETag None
/*
Add Expire Dates