Skip to content

Instantly share code, notes, and snippets.

View smeric's full-sized avatar

Sébastien Méric smeric

View GitHub Profile
<?php
// @link https://github.com/woocommerce/woocommerce/blob/master/includes/admin/wc-meta-box-functions.php#L141
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
@smeric
smeric / woo_cart_has_virtual_product.php
Last active August 2, 2024 00:15 — forked from Katamo/gist:10243188
Check if the WooCommerce cart contains virtual product
<?php
/**
* Check if the cart contains virtual product
*
* @return bool
*/
function woo_cart_has_virtual_product(){
global $woocommerce;
// By default, no virtual product
@smeric
smeric / DB.php
Last active September 20, 2020 21:59
Mysqli Class
<?php
namespace SMeric\Utilities;
/**
* Simple MySQLi Class 0.3.2
*
* @author JReam
* @license GNU General Public License 3 (http://www.gnu.org/licenses/)
*
* This program is free software; you can redistribute it and/or modify it
@smeric
smeric / sanitize-filename.php
Last active July 15, 2016 23:17 — forked from herewithme/sanitize-filename.php
WordPress - No french punctuation and accents for filename
<?php
/*
Plugin Name: No french punctuation and accents for filename
Description: Remove all french punctuation and accents from the filename of upload for client limitation (Safari Mac/IOS)
Plugin URI: http://www.beapi.fr
Version: 1.0
Author: BeAPI
Author URI: http://www.beapi.fr
This program is free software; you can redistribute it and/or
@smeric
smeric / aggregate-feed.php
Created November 12, 2015 23:14 — forked from smajda/aggregate-feed.php
Merge multiple RSS feeds with SimplePie
<?php
/* Merge multiple RSS feeds with SimplePie
*
* Just modify the path to SimplePie and
* modify the $feeds array with the feeds you want
*
* You should probably also change the channel title, link and description,
* plus I added a CC license you may not want
*
* Help from: http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/
@smeric
smeric / Wordpress RSS 2.0 image enclosure .php
Last active October 14, 2015 14:48 — forked from supermethod/Wordpress RSS 2.0 image enclosure
How to add post image(s) as enclosure(s) to a wordpress RSS feed item - add to functions.php
<?php
/**
* Add post type images to feed items
*/
add_action('rss2_item', 'add_images_in_feed' );
function add_images_in_feed() {
global $post;
// Thumbnail...
$thumbnail_ID = get_post_thumbnail_id( $post->ID );