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 ) { | |
// In this example I have added the "custom_label_0" to each feed. | |
// Custom_label_0 is filled with a ISO currency code as a static value | |
// Forinstance the ISO currency code for the US is USD. | |
// uses wmc_get_price() from woocomerce multiple currencies | |
//get the correct price in the correct currency. |
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 | |
/** | |
* Alter Product feed item | |
* Uppercase a source value (attribute_pa_cup) and combine with an other source value in the size attribute | |
*/ | |
function alter_feed_item( $attributes, $feed_id, $product_id ) { | |
// get values | |
$attribute_pa_band = $attributes['custom_label_0']; //add the attribute_pa_band to attribute "custom_label_0" |
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 | |
// wppfm feed ides in queue Filter | |
// | |
function only_last_week_ids( $ids ) { | |
$index = 0; // set the index | |
foreach( $ids as $id ) { | |
$post_date = get_the_date( 'U', $id ); // get the posts published date |
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
/** | |
* Alter Product feed item | |
* Make the title attribute lowercase | |
*/ | |
function alter_feed_item( $attributes, $feed_id, $product_id ) { | |
// lowercase | |
$title = $attributes['title']; | |
$title = strtolower($title); //make lower case | |
$title = ucfirst($title) // maken first character capitalized |
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 alter_feed_item( $attributes, $feed_id, $product_id ) { | |
//global $product; | |
$product = wc_get_product( $product_id ); | |
$featured_image_ids[0] = get_post_thumbnail_id( $product_id ); | |
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id($featured_image_ids[0]), 'full'); | |
if($featured_image) { | |
$attributes['image_link'] = $featured_image[0]; | |
} |
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
// If you want to remove the categories with ids 10, 12, 14 and 16 from the Category Mapping, including their children categories, | |
// you could use the following code in your functions.php file | |
// hook the remove_cats function to the wppfm_category_mapping_exclude_tree event | |
add_filter( 'wppfm_category_mapping_exclude_tree', 'remove_cats' ); | |
function remove_cats() { | |
// return a comma separated string or an array with the category ids you want to exclude | |
return "10,12,14,16"; | |
} |
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 $meta = get_post_meta(get_the_ID());?> | |
<?php if (isset($product)){ ?> | |
<div itemscope itemtype="http://schema.org/Product"> | |
<meta itemprop="name" content="<?php echo get_the_title(get_the_ID()); ?>"> | |
<meta itemprop="productID" content="<?php echo get_the_ID(); ?>"> | |
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer"> | |
<meta itemprop="price" content="<?php echo get_post_meta( get_the_ID(), '_regular_price', true); ?>" /> | |
<meta itemprop="priceCurrency" content="<?php echo get_woocommerce_currency(); ?>" /> | |
<link itemprop="availability" href="http://schema.org/<?php echo $meta['_stock_status'][0] ? 'InStock' : 'OutOfStock'; ?>" /> | |
<meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition" /> |
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
/** | |
* Alter Product feed item | |
* Use the price including tax in the price attribute | |
*/ | |
function alter_feed_item( $attributes, $feed_id, $product_id ) { | |
global $product; | |
$product = wc_get_product( $product_id ); | |
// show price including tax | |
$attributes['price'] = $product->get_price_including_tax() . " USD"; |
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 ) { | |
// The $attributes variable is an array that contains all the product data that goes into the feed. Each item | |
// can be accessed by it's feed key. So if in the feed file an item has a key like 'description', you | |
// can access that specific item by $attributes['description']. | |
// The $feed_id (string) makes it possible to only edit a specific feed. You can find the id of a feed in the | |
// url of the Feed Editor, right after id=. | |
// The $product_id (string) makes it possible to select a specific product id that you want to filter. |
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 | |
/** | |
* More Products Component | |
* | |
* Display X more products. | |
* | |
* @author Matty | |
* @since 1.0.0 | |
* @package WooFramework | |
* @subpackage Component |