Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
wtmujeebu / SAMPLE-HTML
Last active June 23, 2023 05:34
Sample HTML for test
<!DOCTYPE html>
<html>
<head>
<title>Scripts & Iframes</title>
<!-- Google Analytics - Start -->
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
@wtmujeebu
wtmujeebu / functions.php
Created March 4, 2021 05:55
Dequeue GDPR cookie consent script by WebToffee
<?php
function move_gdpr_script() {
if (class_exists('Cookie_Law_Info')) {
if (!is_admin()) {
wp_dequeue_script('cookie-law-info');
wp_enqueue_script('cookie-law-info', '', array('jquery'), false, true);
wp_dequeue_script('cookie-law-info-ccpa');
wp_enqueue_script('cookie-law-info-ccpa', '', array('jquery', 'cookie-law-info'), false, true);
}
@wtmujeebu
wtmujeebu / functions.php
Created June 8, 2022 11:15
Pass product short description instead of long description to Facebook Product Catalog using - WebToffee Product Catalog Sync for WooCommerce
<?php //Please do not copy this line.
add_filter('wt_facebook_product_description_mode', 'wt_facebook_product_catalog_description_mode');
function wt_facebook_product_catalog_description_mode($mode='long') {
$mode = 'short'; // Available values for the description mode is 'short' and 'long'
return $mode;
}
@wtmujeebu
wtmujeebu / functions.php
Last active May 16, 2022 05:36
Show cookie banner with a delay using CookieYes GDPR cookie consent plugin
<?php // Do not copy this line
add_action('wp_footer', 'wt_cli_delay_cookie_banner', 10);
function wt_cli_delay_cookie_banner()
{
if (class_exists('Cookie_Law_Info')) {
?>
<script>
jQuery(function() {
var timeDelay = 3000; //Time in milli seconds, 1000 ms = 1 second.
@wtmujeebu
wtmujeebu / functions.php
Created May 28, 2021 04:31
Add href to links - CookieYes GDPR Cookie Consent
<?php
add_action('wp_footer', 'wt_cli_add_href_to_links');
function wt_cli_add_href_to_links() {
if (class_exists('Cookie_Law_Info')) {
?>
<script>
jQuery(function($) {
wt_cli_links = $('#cookie-law-info-bar a, #cliSettingsPopup a');
wt_cli_links.each(function() {
@wtmujeebu
wtmujeebu / functions.php
Last active March 15, 2022 10:52
Export WooCommerce Gift Card details with Order into separate column
<?php // Do not copy this line
// Alter CSV header
add_filter('hf_alter_csv_header', 'hf_alter_order_csv_header', 10, 2);
function hf_alter_order_csv_header($export_columns, $max_line_items) {
$gift_card_details = array('gift_card', 'gift_card_amount');
array_splice($export_columns, 14, 0, $gift_card_details);
return $export_columns;
@wtmujeebu
wtmujeebu / basfile.html
Last active March 4, 2022 15:18
CookieYes block script/cookies based on consent - www.cookieyes.com
<script async data-cookieyes="cookieyes-analytics" src="https://www.googletagmanager.com/gtag/js?id=UA-144842869-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-144842869-1');
</script>
@wtmujeebu
wtmujeebu / functions.php
Last active February 17, 2022 05:05
Modify FB retailed ID of the product before syncing - using Product Catalog Sync for WooCommerce by WebToffee
<?php // Do not copy this line.
add_filter('wt_fb_sync_product_retailer_id', 'wt_fb_sync_product_retailer_id', 10, 2);
function wt_fb_sync_product_retailer_id($fb_retailer_id, $product) {
$fb_retailer_id = $product->get_sku() ? $product->get_sku() : 'wc_post_id_' . $product->get_id();
return $fb_retailer_id;
}
@wtmujeebu
wtmujeebu / functions.php
Created January 10, 2022 12:22
Export all language products with WPML - Product import export for WooCommerce plugin by WebToffee
<?php // Please do not copy this line
add_filter('woocommerce_csv_product_export_args', 'wt_woocommerce_csv_product_export_args', 10, 1);
function wt_woocommerce_csv_product_export_args($args) {
$args['suppress_filters'] = true;
return $args;
}
@wtmujeebu
wtmujeebu / functions.php
Created November 25, 2021 04:52
Import only the most recent file from FTP using Import export suite for WooCommerce by WebToffee
<?php // Do not copy this line.
add_filter('wt_iew_folder_import_fetched_files','wt_import_latest_file',10,3);
if(!function_exists('wt_import_latest_file')){
function wt_import_latest_file($server_csv_files,$ftp_conn,$remote_file){
rsort($server_csv_files);
return array($server_csv_files[0]);