Skip to content

Instantly share code, notes, and snippets.

View Auke1810's full-sized avatar
🏠
Working from home

Auke Jongbloed Auke1810

🏠
Working from home
View GitHub Profile
@Auke1810
Auke1810 / gist:026c62256939c970fde7851e675b9c96
Created November 30, 2016 13:01 — forked from pullmonkey/gist:783562
Comprehensive PHP VIN Decoder using VIN API
<?
// VIN API decoder for PHP 4.x+
define('ELEMENT_CONTENT_ONLY', true);
define('ELEMENT_PRESERVE_TAGS', false);
function getXML($vin) {
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, 'http://vinapi.skizmo.com/vins/'. $vin.'.xml');
curl_setopt ($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'X-VinApiKey: #YOURAPIKEYGOESHERE#')); //use your API key here
@Auke1810
Auke1810 / more_products.php
Created August 18, 2017 12:08
Te vinden in shelflife/includes/
<?php
/**
* More Products Component
*
* Display X more products.
*
* @author Matty
* @since 1.0.0
* @package WooFramework
* @subpackage Component
@Auke1810
Auke1810 / WP_HTML_Compression
Created November 12, 2016 10:58
html minify snippet class for wordpress.
class WP_HTML_Compression {
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
protected $html;
public function __construct($html) {
if (!empty($html)) {
$this->parseHTML($html);
@Auke1810
Auke1810 / Alter Product feed price item
Last active December 19, 2017 11:17
Use the price including tax in the price attribute for the woocommerce product feed manager
/**
* 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";
@Auke1810
Auke1810 / header.php
Created February 15, 2018 10:35
Easily add the correct structured data using Microdata for Google Merchant, this includes the missing microdata for condition. At the bottom of the header simple add the code below
<?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" />
@Auke1810
Auke1810 / wpmf-mapping-exlude.php
Last active February 27, 2018 09:36
We added the "wppfm_category_mapping_exclude", "wppfm_category_mapping_exclude_tree" and "wppfm_category_mapping_max_categories" filters. You can use these filters to limit the number of categories in the Category Mapping list on the Edit Feed page.
// 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";
}
@Auke1810
Auke1810 / set-image-link-feed-manager.php
Last active March 27, 2018 12:19
set image link feed manager
@Auke1810
Auke1810 / make-item-title-lower-case.php
Last active March 31, 2018 09:04
Make title attribute lowercase
/**
* 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
<?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
@Auke1810
Auke1810 / woocomerce-multipl-currencies-support.php
Last active July 27, 2018 16:38
This little script will help you to use the woocomerce multiple currencies with our woocommerce product feed manager. You are able to create several feeds with different currencies.
<?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.