Skip to content

Instantly share code, notes, and snippets.

Avatar

Philip Porter utopianfool

View GitHub Profile
@utopianfool
utopianfool / woocommerce-change-no-shipping-message.php
Created Nov 3, 2020
Woocommerce change no shipping message in cart and checkout
View woocommerce-change-no-shipping-message.php
<?php
/**
* Change shipping message in cart and checkout
*/
add_filter( 'woocommerce_no_shipping_available_html', 'littleargentina_no_shipping_message' );
add_filter( 'woocommerce_cart_no_shipping_available_html', 'littleargentina_no_shipping_message' );
function littleargentina_no_shipping_message( $message ) {
return __( 'We only ship to the UK. Please select "Deliver to a different address" if you are purchasing from outside the UK' );
}
?>
@utopianfool
utopianfool / convert-2-to-4-spaces-sublime-text.md
Created Oct 9, 2020
Convert 2 space indentation tabs into 4 in Sublime Text 2 or 3
View convert-2-to-4-spaces-sublime-text.md

Here's a neat trick in Sublime Text 2 or 3 to convert your indentation spacing in a document.

TL;DR:

Converting from 2 spaces to 4 spaces:

Ensure tab width is set to 2. Convert your 2-space indentation to tabs, switch to tab width 4, and then convert the indentation back to spaces.

The detailed description:

@utopianfool
utopianfool / cp.shouldstopexecution.js
Created Oct 9, 2020
Fix window.CP.shouldStopExecution used in some codepen scripts to prevent infinite loops - unminified
View cp.shouldstopexecution.js
"use strict";
"object" != typeof window.CP && (window.CP = {}), window.CP.PenTimer = {
programNoLongerBeingMonitored: !1,
timeOfFirstCallToShouldStopLoop: 0,
_loopExits: {},
_loopTimers: {},
START_MONITORING_AFTER: 2e3,
STOP_ALL_MONITORING_TIMEOUT: 5e3,
MAX_TIME_IN_LOOP_WO_EXIT: 2200,
exitedLoop: function(o) {
@utopianfool
utopianfool / cp.shouldstopexecution.min.js
Created Oct 9, 2020
Fix window.CP.shouldStopExecution used in some codepen scripts to prevent infinite loops
View cp.shouldstopexecution.min.js
"use strict";"object"!=typeof window.CP&&(window.CP={}),window.CP.PenTimer={programNoLongerBeingMonitored:!1,timeOfFirstCallToShouldStopLoop:0,_loopExits:{},_loopTimers:{},START_MONITORING_AFTER:2e3,STOP_ALL_MONITORING_TIMEOUT:5e3,MAX_TIME_IN_LOOP_WO_EXIT:2200,exitedLoop:function(o){this._loopExits[o]=!0},shouldStopLoop:function(o){if(this.programKilledSoStopMonitoring)return!0;if(this.programNoLongerBeingMonitored)return!1;if(this._loopExits[o])return!1;var t=this._getTime();if(0===this.timeOfFirstCallToShouldStopLoop)return this.timeOfFirstCallToShouldStopLoop=t,!1;var i=t-this.timeOfFirstCallToShouldStopLoop;if(i<this.START_MONITORING_AFTER)return!1;if(i>this.STOP_ALL_MONITORING_TIMEOUT)return this.programNoLongerBeingMonitored=!0,!1;try{this._checkOnInfiniteLoop(o,t)}catch(o){return this._sendErrorMessageToEditor(),this.programKilledSoStopMonitoring=!0,!0}return!1},_sendErrorMessageToEditor:function(){try{if(this._shouldPostMessage()){var o={action:"infinite-loop",line:this._findAroundLineNumber()};parent
@utopianfool
utopianfool / extra-wow-animations.scss
Created Sep 22, 2020
Extra wow animations in SCSS
View extra-wow-animations.scss
/* WOW animations */
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated.hinge {
@utopianfool
utopianfool / wordpress-template-custom-isotope.php
Created Sep 22, 2020
The template for displaying cpt with isotope, bootstrap 4 and acf
View wordpress-template-custom-isotope.php
<?php
/**
* The template for displaying cpt with isotope, bootstrap 4 and acf
* Template Name: Custom Isotope
*
* @package wordpress
*/
get_header();
?>
@utopianfool
utopianfool / worpress-custom-login-logo.php
Created Sep 22, 2020
WordPress Custom Login Logo Function
View worpress-custom-login-logo.php
<?php
/**
* Add custom logo to login
*/
function custom_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/login-logo.png);
height:65px;
width:320px;
@utopianfool
utopianfool / accordion-wordpress-bootstrap-acf.html
Created Sep 22, 2020
Accordions in 2 column WordPress Bootstrap ACF Example
View accordion-wordpress-bootstrap-acf.html
<section class="content-section">
<div class="container">
<div class="row justify-content-center py-3">
<div class="col-12 col-md-6 mb-3 pb-3">
<?php the_field('left_column_content'); ?>
<div class="accordion" id="fact-accordion">
<?php if( have_rows('accordion') ): ?>
@utopianfool
utopianfool / ekko-lightbox-jquery-example.js
Created Sep 22, 2020
Ekko Lightbox for Bootstrap and WordPress Example jQuery
View ekko-lightbox-jquery-example.js
jQuery(function($){
// Ekko lightbox attribute data-toggle to gallery links
$('.gallery-item').find('a').attr('data-toggle', 'lightbox');
$('.gallery-item').find('a').attr('data-gallery', 'gallery');
$('.gallery-item').find('a').attr('data-type', 'image');
// enable ekko lightbox on page
$(document).on('click', '[data-toggle="lightbox"]', function(event) {
event.preventDefault();
$(this).ekkoLightbox({
@utopianfool
utopianfool / ekko-lightbox-gallery-example.scss
Created Sep 22, 2020
Ekko Lightbox for Bootstrap and WordPress Example SCSS
View ekko-lightbox-gallery-example.scss
You can’t perform that action at this time.