Skip to content

Instantly share code, notes, and snippets.

Brad Griffin BurlesonBrad

View GitHub Profile
View snippet.php
/** Disable Ajax Call from WooCommerce */
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
function dequeue_woocommerce_cart_fragments() {
if (is_front_page()) wp_dequeue_script('wc-cart-fragments');
}
@BurlesonBrad
BurlesonBrad / header-tracking-snippet.php
Created Jan 27, 2020
🚫No WordPress plugin needed to add tracking code to the header 👍
View header-tracking-snippet.php
function header_tag_analytics() { ?>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-XX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-XX');
</script>
// Add your Tweeder scripts Adroll scripts Facebook scripts BounceX scripts Optimizely scripts or whatever needs to be in the head
@BurlesonBrad
BurlesonBrad / snippet.php
Created Nov 4, 2019
Jason changes the WooCommerce Checkout Custom Ajax Spinner
View snippet.php
add_action('wp_head', 'custom_ajax_spinner', 1000 );
function custom_ajax_spinner() {
?>
<style>
.woocommerce .blockUI.blockOverlay:before,
.woocommerce .loader:before {
height: 3em;
width: 3em;
position: absolute;
top: 50%;
@BurlesonBrad
BurlesonBrad / promise.php
Created Oct 29, 2019
/wp-content/plugins/google-site-kit/third-party/react/promise/src/
View promise.php
<?php
namespace Google\Site_Kit_Dependencies\React\Promise;
class Promise implements \Google\Site_Kit_Dependencies\React\Promise\ExtendedPromiseInterface, \Google\Site_Kit_Dependencies\React\Promise\CancellablePromiseInterface
{
private $canceller;
private $result;
private $handlers = [];
private $progressHandlers = [];
@BurlesonBrad
BurlesonBrad / .htaccess
Created Oct 23, 2019
Get *ALL* domain addresses pointed in the *RIGHT* direction 👍
View .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://domain.com%{REQUEST_URI} [L,NE,R=301]
@BurlesonBrad
BurlesonBrad / snippets.php
Created Apr 24, 2019
Miranda: Add these two snippets to the "Code Snippets" plugin.
View snippets.php
function redirect_to_home_if_author_parameter() {
$is_author_set = get_query_var( 'author', '' );
if ( $is_author_set != '' && !is_admin()) {
wp_redirect( home_url(), 301 );
exit;
}
}
add_action( 'template_redirect', 'redirect_to_home_if_author_parameter' );
@BurlesonBrad
BurlesonBrad / suspend.php
Created Mar 19, 2019
for Amanda Brookshire
View suspend.php
<?php /* <---don't add that line if you're pasting this into a snippets plugin */
add_filter( 'gettext', 'amanda_changes_suspend_to_pause', 20, 3 );
function amanda_changes_suspend_to_pause( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Suspend' :
$translated_text = __( 'Pause', 'woocommerce' );
break;
}
}
@BurlesonBrad
BurlesonBrad / autocomplete-virtual-orders.php
Created Jan 24, 2019
Automatically Complete All Virtual Orders In WooCommerce
View autocomplete-virtual-orders.php
/**
* AutoComplete Virtual Orders
*/
function autocomplete_virtual_orders_in_woocommerce( $order_id ) {
// if there is no order id, then stop
if ( ! $order_id ) {
return;
}
View amiriqbalmcs.css
a.cl-effect-2{
-webkit-perspective:1000px;
-moz-perspective:1000px;
perspective:1000px;
color:#fff;
}
a.cl-effect-2 span{
position:relative;
display:inline-block;padding:0 14px;
View roles-cap.php
function ap_user_can_read_comments( $_post = null, $user_id = false ) {
$_post = ap_get_post( $_post );
// Get current user if no user_id supplied
if ( false === $user_id ) {
$user_id = get_current_user_id();
}
// All support admins get the green light
if ( is_super_admin( $user_id ) ) {
You can’t perform that action at this time.