View product_old_new.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function product_old_new( $attributes, $feed_id, $product_id ) { | |
global $product; | |
// Get product creat | |
$product = wc_get_product( $product_id ); | |
$product_created = strtotime($product->get_date_created()); | |
// Calculate the date 10 days ago |
View add_availability_date_when_backorder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_availability_date_when_backorder( $attributes, $feed_id, $product_id ) { | |
$wc_product = wc_get_product( $product_id ); // Get the WC_Product Object | |
if ($wc_product->is_on_backorder() ) { | |
// add availability_date attribute | |
$attributes['availability_date'] = gmdate( 'c', strtotime( '+7 days' ) ); | |
} | |
View wppfm_add_product_attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wppfm_add_product_attributes( $attributes, $feed_id, $product_id ) { | |
$wc_product = wc_get_product( $product_id ); // Get the WC_Product Object | |
if ( $wc_product instanceof WC_Product_Variation || $wc_product instanceof WC_Product_Variable ) { | |
$product_attributes = $wc_product->get_attributes(); // Get the product attributes | |
// Loop through the attributes and add them to the $attributes array | |
foreach ( $product_attributes as $key => $value ) { | |
if ( $value ) { | |
$attributes[ $key ] = $value; |
View replace Yoast SEO shortcodes in title and description attribuut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function replace_yoast_seo_title( $attributes, $feed_id, $product_id ) { | |
// replace %%title%% with the product title. | |
$attributes['title'] = str_replace('%%title%%', get_the_title($product_id), $attributes['title']); | |
$attributes['description'] = str_replace('%%title%%', get_the_title($product_id), $attributes['description']); | |
// replace %%sitename%% with the site name | |
$attributes['title'] = str_replace('%%sitename%%', get_bloginfo('name'), $attributes['title']); |
View wppfm_exclude_product_ids_from_feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// woocommerce product feed manager (www.marketingrobot.com) | |
// Removes specific products ID's from the feed generation process | |
function wppfm_exclude_product_ids_from_feed( $products_queue, $feed_id ) { | |
$products_to_exclude = array( | |
'20872', | |
'20875', | |
'20876', | |
'20879', | |
'20883', | |
'20895', |
View shortcoder support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wppfm_shortcoder_support( $attributes, $feed_id, $product_id ) { | |
if ( has_custom_field( $attributes['description'] ) ) { | |
$description = $attributes['description']; | |
$attr = [ 'name' => get_shortcode_name_from_description( $description ) ]; | |
//parse shortcodes do_shortcode | |
$attributes['description'] = process_product_shortcode( $attr, $description, $product_id ); | |
} |
View wppfm_product_category_string_gets_full_category_path.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wppfm_product_category_string_gets_full_category_path( $data, $feed_id, $product_id ) { | |
$data['product_type'] = WPPFM_Taxonomies::get_shop_categories( $product_id, ' > ' ); | |
// Always return data! | |
return $data; | |
} | |
View alter-descr-item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function alter_feed_item( $attributes, $feed_id, $product_id ) { | |
// Strip from description attributes | |
$attributes['description'] = str_replace(' ', ' ', $attributes['description']); | |
// IMPORTANT! Always return the $attributes | |
return $attributes; | |
} |
View gist:ba1f71311df86b19b580ff81c5216d25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
function wppfm_add_taxonomy_data_to_feed( $data, $feed_id, $product_id ) { | |
// Get the product_badges taxonomy data. | |
$taxonomyName = 'product_taxonomy_data'; // use the name of your own taxonomy | |
$taxonomyData = wp_get_post_terms( $product_id, $taxonomyName ); | |
if ( $taxonomyData ) { |
View uppercase_words_title.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function string_uppercase_title( $attributes, $feed_id, $product_id ) { | |
// this line changes the title data and removes the " <prompt> " string | |
$attributes['title'] = ucwords(strtolower($attributes['title'])); | |
// IMPORTANT! Always return the $attributes | |
return $attributes; | |
} |
NewerOlder