Skip to content

Instantly share code, notes, and snippets.

Sébastien Méric smeric

Block or report user

Report or block smeric

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@smeric
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
<?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
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
<?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
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
<?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 / 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%;
@smeric
smeric / add-roles-to-body.php
Created Feb 19, 2016
Add user roles as classes to body tag in front and backend.
View add-roles-to-body.php
<?php
/**
* Add user roles as classes to body tag in front and backend.
*/
add_filter( 'body_class','add_roles_to_body' );
add_filter( 'admin_body_class', 'add_roles_to_body' );
function add_roles_to_body( $classes ) {
global $current_user;
foreach ( $current_user->roles as $user_role ) {
View plugin-name include class-plugin-name-loader.php
<?php
/**
* Register all actions, filters and shortcodes for the plugin
*
* @link http://example.com
* @since 1.0.0
*
* @package Plugin_Name
* @subpackage Plugin_Name/includes
@smeric
smeric / aggregate-feed.php
Created Nov 12, 2015 — forked from smajda/aggregate-feed.php
Merge multiple RSS feeds with SimplePie
View aggregate-feed.php
<?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/
View smooth-scroll.js
/**
* Smooth scroll :
* <a href="#top" class="go-top">Top</a>
* $( '.go-top' ).click( function( e ){ e.preventDefault(); $( this ).autoscroll( $( this ).attr( 'href' ) ); });
**/
( function( $ ) {
$.fn.autoscroll = function( selector ) {
$( 'html,body' ).animate({
scrollTop: $( selector ).offset().top
}, 200);
@smeric
smeric / add2any_custom_js.php
Last active Oct 30, 2015
WordPress AddToAny custom script to : push shared data to datalayer for GTM, re-shape title to remove special characters & use shortlink for Twitter
View add2any_custom_js.php
<?php
/**
* AddToAny : custom script inserted into the document head
*
* Push shared data to datalayer for GTM
* Re-shape title to remove special characters
* Use shortlink for Twitter
*
* see https://www.addtoany.com/ext/google_analytics/
* see https://www.addtoany.com/buttons/customize/wordpress/events
@smeric
smeric / remove-old-slugs-redirects.php
Last active Oct 16, 2015
WordPress plugin. Removes selected old slugs/permalinks from database.
View remove-old-slugs-redirects.php
<?php
/**
* Remove old slugs redirects.
*
* Removes selected old slugs/permalinks from database.
*
* @package WordPress_Remove_Old_Slugs_Redirects
* @author Sébastien Méric <sebastien.meric@gmail.com>
* @credit Algoritmika Ltd. <http://www.algoritmika.com>
* @license GPL-2.0+
You can’t perform that action at this time.