Skip to content

Instantly share code, notes, and snippets.

@leewillis77
leewillis77 / functions.php
Last active October 16, 2019 04:35
Modify the product_type element in the Google Product Feed
<?php
function lw_woocommerce_gpf_feed_item_google( $feed_item, $product ) {
// Modify $feed_item->additional_elements['product_type'] here, e.g.
$feed_item->additional_elements['product_type'] = [
'Product ID ' . $product->get_id(),
];
return $feed_item;
}
add_filter( 'woocommerce_gpf_feed_item_google', 'lw_woocommerce_gpf_feed_item_google', 10, 2 );
@leewillis77
leewillis77 / functions.php
Created September 3, 2019 15:00
Add alternate send times to recovery campaigns in Cart Recovery Pro for WordPress
<?php
function lw_crfwp_timing_options( $options ) {
// 259200 is the number of seconds in 72 hours.
$options[259200] = '72 Hours';
return $options;
}
add_filter( 'crfwp_timing_options', 'lw_crfwp_timing_options' );
@maxkostinevich
maxkostinevich / functions.php
Last active February 11, 2023 20:03
WordPress: Export custom data to CSV
<?php
/**
* Export Data to CSV file
* Could be used in WordPress plugin or theme
*/
// A sample link to Download CSV, could be placed somewhere in plugin settings page
?>
<a href="<?php echo admin_url( 'admin.php?page=myplugin-settings-page' ) ?>&action=download_csv&_wpnonce=<?php echo wp_create_nonce( 'download_csv' )?>" class="page-title-action"><?php _e('Export to CSV','my-plugin-slug');?></a>
@devinsays
devinsays / wc-footer-conversion-tracking-example.php
Last active July 18, 2023 14:27
Example of WooCommerce Conversion Tracking in wp_footer
@robinnorth
robinnorth / wordpress_export-post-data.php
Created April 26, 2013 11:44
WordPress: Simple, configurable script to export post data to a CSV file
<?php
/**
* Export WordPress post data to CSV
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/>
*/
/**
*********************************************************************
* Configuration
*********************************************************************