Skip to content

Instantly share code, notes, and snippets.

View alewolf's full-sized avatar

Aleksandar alewolf

View GitHub Profile
@alewolf
alewolf / search-results.php
Last active May 30, 2023 23:45
SearchWP Live Ajax Search results with thumbnails
<?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 / gads-id-for-wc-google-listing-ads.php
Last active May 19, 2023 07:57
Enable product ID output for woopt Pixel Manager Google Ads dynamic remarketing for the WooCommerce Google Listing and Ads plugin
<?php
// Place the following code into your functions.php file in your child theme
add_filter('wooptpm_product_ids', function ($product_ids, $product) {
$product_ids['gla'] = 'gla_' . $product->get_id();
return $product_ids;
}, 10, 2);
<?php
/**
* This mu plugin deactivates the Pixel Manager
* while the Thrive Theme editor is active.
*
* Create a file disable-pmw-on-thrive-editor.php.
* Place it in the /mu-plugins/ folder within the /wp-content/ folder.
* If the /mu-plugins/ folder doesn't exist yet, it must be manually created.
*/
RENAME TABLE
wp_actionscheduler_logs TO custom_prefix_actionscheduler_logs,
wp_actionscheduler_groups TO custom_prefix_actionscheduler_groups,
wp_actionscheduler_claims TO custom_prefix_actionscheduler_claims,
wp_actionscheduler_actions TO custom_prefix_actionscheduler_actions
<?php
/**
* If you want to fire the ViewItem event on variable products when
* no variation has been selected yet, then use the following code in
* your functions.php file.
*/
add_action('wp_footer', function () {
?>
<script>
<?php
/**
* Track custom add-to-cart conversions using the WooCommerce Pixel Manager
*
* Add this to your functions.php file
*/
add_action('wp_footer', function () {
?>
<?php
/**
* Track ViewItem events in Facebook using the WooCommerce Pixel Manager
* Add this to functions.php
*/
add_action('wp_footer', function (){
?>
<script>
@alewolf
alewolf / wpm_google_ads_conversion_identifiers.php
Last active February 1, 2022 11:01
add conversion identifiers to the Google Ads pixel output
<?php
/*
* Since version 1.8.2 of the plugin.
*
* This filter will add aditional conversion ID and label pairs to the output
* of the Google Ads pixel.
*
* It will add the output to every page with the Google Ads remarketing pixel,
* including the purchase confirmation page.
(function(){
try {
let observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName === "class") {
let attributeValue = jQuery(mutation.target).prop(mutation.attributeName);
if (attributeValue.includes('disabled')) {
jQuery('.fs-modal').find('.button-deactivate').removeClass('disabled');;
}
}
// First you'll need to load the gtag.js library
function load_library(){
echo '<script async src="https://www.googletagmanager.com/gtag/js?id=GA_UA_PROPERTY_ID"></script>';
}
// Then output the conversion tracking scripts
// The Google Ads conversion ID must include the "AW-" in front of the number
function (response)