Skip to content

Instantly share code, notes, and snippets.

@timersys
timersys / functions.php
Created August 1, 2014 19:48
show uncompressed javascript in popups plugin
<?php
// show uncompressed javascript in popups plugin http://wordpress.org/plugins/popups/
define( 'SPU_DEBUG_MODE', true );
@timersys
timersys / class-social-popup.php
Created August 5, 2014 13:12
WSI facebook register script
wp_register_script( 'spu-facebook', 'http://connect.facebook.net/'.get_locale().'/all.js#xfbml=1', array('jquery'), self::VERSION, FALSE);
@timersys
timersys / functions.php
Created August 18, 2014 14:25
My Creed multiple points wiht WSI
add_filter( 'wsi_cred_type', 'mycreed_points_types', 10, 2);
function mycreed_points_types( $cred_type, $wsi_obj_id ){
// default mycreed type
$cred_type = 'mycred_default';
// invitations sent on page with id 2
if( '2' == $wsi_obj_id ) {
$cred_type = 'my_points_type';
}
@timersys
timersys / class.Wsi_Mycreed.php
Created August 18, 2014 14:54
My Creed Wsi integration
<?php
/**
* MyCred Hook
* @since v2
* @version 1.1
*/
class Wsi_MyCreed extends myCRED_Hook {
/**
* Construct
@timersys
timersys / class-frontend-box.php
Created August 30, 2014 14:38
Wordpress Front end notifications
<?php
/**
* Frontend_box class will help you to create bootstrap style alert boxes on your theme
* @author Damian Logghe <info@timersys.com>
* @license GPL-2.0+
* @link http://wp.timersys.com/how-to-create-bootstraps-style-alert-boxes-in-your-theme/
* @version 1.0
*/
class Frontend_box {
@timersys
timersys / functions.php
Created September 11, 2014 22:23
Adding a custom rule to Wordpress Popups Plugin
/* http://wordpress.org/plugins/popups/
* Adding a custom rule to display popup only on
* single posts of certain category
* /
add_filter('spu/rules/rule_match/post_category', 'spu_rule_match_post_category', 12, 2);
function spu_rule_match_post_category($match, $rule){
global $post;
// validate
if( !$post->ID )
@timersys
timersys / functions.php
Last active August 29, 2015 14:07
Wordpress Social Invitations share custom url for logged user
add_filter( 'wsi/placeholders/custom_url', 'wsi_my_custom_link' );
function wsi_my_custom_link() {
global $current_user;
get_currentuserinfo();
//return home url with ref username
return site_url('?mref='.$current_user->user_login);
//return the same shortened with goo.gl
@timersys
timersys / jetpack.php
Last active August 29, 2015 14:07
WordPress Jetpack subscription form shortcode
[jetpack_subscription_form show_subscribers_total="true"]
@timersys
timersys / gist:03067ac7594fdce288ca
Last active May 18, 2019 15:15
Wordpress popups plugin. Allow editors to edit popups
<?php // <-- don't add this in your functions.php if already there
/**
* https://wordpress.org/support/plugin/popups
* Allow editors to edit popups
* For more roles check https://codex.wordpress.org/Roles_and_Capabilities
*/
add_filter('spu/settings_page/roles', 'my_custom_role');
function my_custom_role(){
return 'edit_others_posts';
}
@timersys
timersys / gist:a5a8d733ddb96e229954
Created December 4, 2014 12:02
Display a shortcode code without parsing it
/**
* If you need to show a shortcode code and double
* brackets ar enot working for you [[]]
* you can always try this
*/
add_shortcode('raw','raw_fc');
function raw_fc($atts, $content){
remove_filter( 'the_content', 'do_shortcode', 11 );
return '<code>'.$content.'</code>';
add_filter( 'the_content', 'do_shortcode', 11 );