Skip to content

Instantly share code, notes, and snippets.

Sébastien Méric smeric

View GitHub Profile
smeric / nemus-slider.php
Last active Dec 18, 2017
WordPress Nemus Slider : PHP Fatal error: Call to a member function add_cap() on a non-object in /PATH/TO/SITE/FOLDER/wp-content/plugins/nemus-slider/nemus-slider.php on line 97
View nemus-slider.php
* Nemus Slider
* nemus-slider.php line 75
* Reported issue :
function nemus_slider_add_caps_to_admin() {
smeric / extend-woocommerce-memberships-period.php
Created Oct 6, 2016
WooCommerce Memberships : allow renewal for active memberships even before membership expiration.
View extend-woocommerce-memberships-period.php
* Allow membership renewal for active memberships
add_filter( 'wc_memberships_valid_membership_statuses_for_renewal', 'my_valid_membership_statuses_for_renewal' );
function my_valid_membership_statuses_for_renewal( $statuses = array() ) {
$statuses[] = 'active';
return $statuses;
smeric / html-tags-shortcode.php
Created Oct 7, 2017
WordPress HTML tags shortcode. So you may add HTML to escaped form fields values :)
View html-tags-shortcode.php
* HTML tags shortcode
* Usage: [html tag="span" class="myClass" id="firstSpan"]Lorem ipsum[html tag='br']dolor sit amet[/html]
function html_tag_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'tag' => 'div',
'id' => '',
smeric / woocommerce-membership-post-excerpt.php
Created Nov 23, 2015
WooCommerce membership custom post excerpt. Instead of using the excerpt this will display the begining of a post for non members.
View woocommerce-membership-post-excerpt.php
* Plugin Name: WooCommerce membership custom post excerpt
* Description: Instead of using the excerpt this will display the begining of a post for non members.
* Version: 0.1
* Author: Sébastien Méric <>
* Author URI:
defined( 'ABSPATH' ) OR exit;
View Blockstack ID
Verifying that "" is my Blockstack ID.
smeric / woocommerce-overwrite-default-thumbnail-sizes.php
Created Oct 11, 2016
Overwrite default thumbnails sizes after WooCommerce installation
View woocommerce-overwrite-default-thumbnail-sizes.php
add_action( 'after_setup_theme', 'mytheme_woocommerce_set_image_dimensions' );
function mytheme_woocommerce_set_image_dimensions() {
// Do not set sizes multiple times
if ( ! get_option( 'mytheme_shop_image_sizes_set' ) ) {
$catalog = array(
'width' => '768', // px
'height' => '', // px
'crop' => 0 // no-crop
smeric / yoast-seo-social-images-sizes.php
Created Oct 11, 2016
Overwrite Yoast SEO Facebook & Twitter sharing images declaration with a custom one.
View yoast-seo-social-images-sizes.php
* Std image size for social sharing.
add_action( 'after_setup_theme', 'mytheme_setup_theme' );
function mytheme_setup_theme() {
add_image_size( 'social-800x420', 800, 420, true );
smeric / automatically-disable-content-access.php
Last active Sep 9, 2016
Make Woocommerce Membership public content go private after a certain amount of time.
View automatically-disable-content-access.php
To allow temporary access to content with Woocommerce Membership,
you have to check this checkbox : "Check this box if you want to
force the content to be public regardless of any restriction rules
that may apply now or in the future."
Here is a way to make this access temporary without having to edit
you post to uncheck the checkbox each and every day on each new publicly
released content. Let the WordPress cron job uncheck it for you :)
smeric / sanitize-filename.php
Last active Jul 15, 2016 — forked from herewithme/sanitize-filename.php
WordPress - No french punctuation and accents for filename
View sanitize-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:
Version: 1.0
Author: BeAPI
Author URI:
This program is free software; you can redistribute it and/or
smeric / truncated_content_shortcode.css
Last active Feb 25, 2016
A wordpress shortcode to display the current post truncated content. I did this shortcode to use with Paid Member Subscriptions in the first place...
View truncated_content_shortcode.css
/* truncated content styles : add this to the child theme style.css */
div.truncated_content {
position: relative;
div.truncated_content:before {
content: '';
position: absolute;
width: 100%;
height: 100px;
height: 100%;
You can’t perform that action at this time.