This file contains hidden or 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 | |
/** | |
* 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 ) { |
This file contains hidden or 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 | |
/** | |
* Username auto generation for Gravity Form User Registration Add-on | |
* | |
* see https://www.gravityhelp.com/documentation/article/gform_username/ | |
*/ | |
add_filter( 'gform_username', 'auto_username', 10, 4 ); | |
function auto_username( $username, $feed, $form, $entry ) { | |
//$username = strtolower( rgar( $entry, '2.3' ) . rgar( $entry, '2.6' ) ); |
This file contains hidden or 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 | |
/** | |
* 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 <[email protected]> | |
* Author URI: http://www.sebastien-meric.com/ | |
**/ | |
defined( 'ABSPATH' ) OR exit; |
This file contains hidden or 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 | |
/* 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/ |
This file contains hidden or 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
/** | |
* 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); |
This file contains hidden or 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 | |
/** | |
* 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 |
This file contains hidden or 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 | |
/** | |
* 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 ); |
This file contains hidden or 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 | |
/** | |
* Add to cart before applying coupon | |
* | |
* Made to be used with the "Smart Coupons" WooCommerce extention. | |
* If we apply coupon from url and the coupon is dedicated to a specific product, the coupon is not applied if | |
* the product is not already in cart. So, before applying the coupon we add this product to cart. | |
* | |
* @link | |
* @version 1.0.1 |
This file contains hidden or 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 | |
/** | |
* Register all actions, filters and shortcodes for the plugin | |
* | |
* @link http://example.com | |
* @since 1.0.0 | |
* | |
* @package Plugin_Name | |
* @subpackage Plugin_Name/includes |
This file contains hidden or 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 | |
/** | |
* Remove old slugs redirects. | |
* | |
* Removes selected old slugs/permalinks from database. | |
* | |
* @package WordPress_Remove_Old_Slugs_Redirects | |
* @author Sébastien Méric <[email protected]> | |
* @credit Algoritmika Ltd. <http://www.algoritmika.com> | |
* @license GPL-2.0+ |