Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
wtmujeebu / functions.php
Created October 13, 2021 07:18
ReviewX review additional meta import and export
<?php //do not copy this line
// Add in exporting site
add_filter('wt_alter_product_reviews_export_csv_data', 'wt_alter_product_reviews_export_csv_data');
function wt_alter_product_reviews_export_csv_data($csv_row) {
if (isset($csv_row['meta:reviewx_attachments']) && !empty($csv_row['meta:reviewx_attachments'])) {
$images_url = array();
@wtmujeebu
wtmujeebu / functions.php
Last active October 8, 2021 06:55
Modify cron check interval - import export suite by WebToffee
<?php
add_filter('wt_iew_cron_interval_details', 'wt_iew_cron_interval_details_fn');
function wt_iew_cron_interval_details_fn($schedules) {
$schedules['wt_iew_cron_interval'] = array(
'interval' => (60), //60 second
'display' => __('Every minute'),
);
return $schedules;
}
@wtmujeebu
wtmujeebu / functions.php
Created October 4, 2021 11:18
webp image support for Product Import Export for WooCommerce plugin by WebToffee
function wt_mime_types($mime_types) {
$mime_types['webp'] = 'image/webp'; //Adding webp extension
return $mime_types;
}
add_filter('upload_mimes', 'wt_mime_types', 1, 1);
@wtmujeebu
wtmujeebu / functions.php
Created June 29, 2021 11:05
WC Booking product compatibility
<?php
add_action('wt_woocommerce_product_import_inserted_product_object', 'wt_woocommerce_product_import_inserted_product_object', 10, 2);
function wt_woocommerce_product_import_inserted_product_object($product, $data) {
if (isset($data['meta_data'])) {
foreach ($data['meta_data'] as $meta) {
@wtmujeebu
wtmujeebu / functions.php
Created June 25, 2021 10:25
Google Product Feed - Export and Import with WooCommerce product import export by WebToffee
<?php
add_filter('wt_woocommerce_product_importer_pre_parse_data', 'wt_woocommerce_product_importer_pre_parse_feed_data');
function wt_woocommerce_product_importer_pre_parse_feed_data($mapped_data) {
$wt_gpf_data_array = array('meta:wt_gpf_title', 'meta:wt_gpf_availability', 'meta:wt_gpf_brand', 'meta:wt_gpf_mpn', 'meta:wt_gpf_product_type', 'meta:wt_gpf_google_product_category', 'meta:wt_gpf_size_system');
$gpf_data = array();
foreach ($mapped_data as $mkey => $mvalue) {
@wtmujeebu
wtmujeebu / functions.php
Last active June 24, 2021 08:45
Allow Shop Managers to add another role user - using Import Export WordPress Users and WooCommerce Customers plugin by WebToffee
<?php
/**
* Allow Shop Managers to add another shop manager/custom role
*/
function wt_shop_manager_role_edit_capabilities($roles) {
$roles[] = 'shop_manager'; // change role here for custom roles
$roles[] = 'customrole'; // change role here for custom roles
return $roles;
@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
Created May 24, 2021 09:52
Optimize CSS - CookieYes GDPR Cookie Consent
<?php
function wt_cli_add_rel_preload($html, $handle, $href, $media) {
$preload = array(
'cookie-law-info',
'cookie-law-info-gdpr',
'cookie-law-info-table'
);
if (in_array($handle, $preload)) {
return '<link rel="preload" as="style" onload="this.onload=null;this.rel=' . "'stylesheet'" . '" id="' . $handle . '-css" href="' . $href . '" type="text/css" media="all" />' . "\n";
@wtmujeebu
wtmujeebu / functions.php
Created May 21, 2021 05:26
To remove any conflicting click event from the accordion of settings popup - CookieYes GDPR Cookie Consent
<?php
add_action('wp_footer', 'wt_cli_remove_conflict_click_event');
function wt_cli_remove_conflict_click_event() {
if (class_exists('Cookie_Law_Info')) {
?>
<script>
jQuery(function() {
setTimeout(function() {
jQuery('.cli-modal-body a[data-target]').off('click');
@wtmujeebu
wtmujeebu / functions.php
Created May 21, 2021 03:36
To move admin scripts to footer - CookieYes GDPR Cookie Consent
<?php
function wt_move_gdpr_script_to_footer() {
if (class_exists('Cookie_Law_Info')) {
wp_dequeue_script('cookie-law-info');
wp_enqueue_script('cookie-law-info', '', array(), false, true);
}
}
add_action( 'admin_enqueue_scripts', 'wt_move_gdpr_script_to_footer', 999 );