Skip to content

Instantly share code, notes, and snippets.

@alewolf
alewolf / search-results.php
Last active Aug 8, 2017
SearchWP Live Ajax Search results with thumbnails
View search-results.php
<?php
/**
* This template adds thumbnails to your SearchWP Live Ajax Search results.
*
* Create a folder called searchwp-live-ajax-search in your child theme folder and copy this file in there.
* In order for this to work you require the SearchWP and SearchWP Live Ajax Search plugins installed and active.
*
*/
?>
@alewolf
alewolf / gist:daae9228b396e3fd6216b5d72af17da7
Last active Nov 17, 2017
AdWords Script: Triple Match
View gist:daae9228b396e3fd6216b5d72af17da7
// Title: Triple Match
// Descritpion: Adds the missing match types of each keyword in every ad group
// Author: Wolf+Bär Agency, Aleksandar Vucenovic
// License: GNU GPLv3
// Version: 0.1
// URL: https://gist.github.com/alewolf/daae9228b396e3fd6216b5d72af17da7
// URL:
// START Settings
@alewolf
alewolf / gist:2d8e85a9a753fa5ee4039fb1f779f878
Last active Nov 17, 2017
Automatic AdWords Website Phone Conversion Script
View gist:2d8e85a9a753fa5ee4039fb1f779f878
<script type="text/javascript">
// In contrary to the original AdWords Phone Conversion Tracking Script this version doesn't require changes on the website. It even can implemented using Google Tag Manager.
// The original AdWords script requires an additional <span> element with an id that encloses the phone number.
// This new script doens't require that span element anymore. It autoaticall searches through the entire document and changes all phone numbers that match. Also it searches through all href sources and changes the phone number there too (for clickable phone numbers).
// In this version of the script there is one requirement though. The phone number on the website has to bee written in the exact same format, with spaces, etc. Only then the script will find and exchange the numbers.
// AdWords phone conversion ID. Since this is a number no quotation marks are necessary.
var gak = CONVERSION_ID; // eg. 12345678912
// AdWords conversion label
@alewolf
alewolf / gist:91bc532014453ec2eac801bf342ee1f9
Last active Nov 28, 2017
AdWords MCC Script: Switch all broad match keywords to modified broad match
View gist:91bc532014453ec2eac801bf342ee1f9
/*
* Title: Modified Broad Match MCC
* Descritpion: Switch all broad match keywords to modified broad match
* Author: Wolf+Bär Agency, Aleksandar Vucenovic
* License: GNU GPLv3
* Version: 0.4
* URL: https://gist.github.com/alewolf/91bc532014453ec2eac801bf342ee1f9
* URL:
*/
@alewolf
alewolf / gist:ae90ea9c658df09b08d129f58575213c
Last active Mar 19, 2018
AdWords MCC Script: Triple Match
View gist:ae90ea9c658df09b08d129f58575213c
/**
* Title: Triple Match MCC
* Descritpion: Adds the missing match types of each keyword in every ad group
* Author: Wolf+Bär Agency, Aleksandar Vucenovic
* Website: https://wolfundbaer.ch
* License: GNU GPLv3
* Version: 0.4
* URL: https://gist.github.com/alewolf/ae90ea9c658df09b08d129f58575213c
* URL:
*/
View new-reply-to.php
<?php
// replace reply-to email address for WooCommerce customer emails
add_filter( 'woocommerce_email_headers', 'new_customer_order_reply_to_email_address', 20, 3 );
function new_customer_order_reply_to_email_address( $header, $email_id ) {
$customer_email_ids = array(
'customer_on_hold_order',
'customer_processing_order',
View .htaccess
# BEGIN WPML Redirect
RewriteEngine on
RewriteCond %{QUERY_STRING} lang=(..) [NC]
RewriteCond %{REQUEST_URI} !^/wp-admin [NC]
RewriteRule ^(.*\/)|^$ /%1/$1? [L,R=301]
# END WPML Redirect
@alewolf
alewolf / gist:275278f1da379b56512d
Last active May 5, 2020
MaxMind GeoIP city locator for unbounce forms
View gist:275278f1da379b56512d
<script type="text/javascript">
$( window ).load(function(){
$.getScript("//geoip-js.com/js/apis/geoip2/v2.1/geoip2.js", function() {
var onSuccess = function(geoipResponse) {
// change '#lp-pom-form-64 #city' to match your form ID and field name
$('#lp-pom-form-64 #city')[0].value = geoipResponse.city.names.en;
};
@alewolf
alewolf / gist:e6fcecfba548c765a4ad52d46abcd81e
Last active May 5, 2020
AdWords Script: Switch all broad match keywords to modified broad match
View gist:e6fcecfba548c765a4ad52d46abcd81e
// Title: Modified Broad Match
// Descritpion: Switch all broad match keywords to modified broad match
// Author: Wolf+Bär Agency, Aleksandar Vucenovic
// License: GNU GPLv3
// Version: 0.3
// URL: https://gist.github.com/alewolf/e6fcecfba548c765a4ad52d46abcd81e
// URL:
// START Settings
@alewolf
alewolf / gist:5d933417e35a3d7585b96e2ada9f2e05
Last active Jul 15, 2020
resync variable product in WooCommerce
View gist:5d933417e35a3d7585b96e2ada9f2e05
<?php
/***********************************************************************************************
* This function will automatically resync variable product prices in case the prices don't show
* on the catalogue pages anymore.
*
* Simply place it in functions.php
***********************************************************************************************/
add_filter( 'woocommerce_get_price_html', 'resync_variable_product', 100, 2 );