Skip to content

Instantly share code, notes, and snippets.

@timersys
timersys / functions.php
Created February 27, 2016 14:24
Filter to make maxbuttons WordPress Plugin compatible with popups plugin
<?php
/**
* Filter to make maxbuttons WordPress Plugin (https://es.wordpress.org/plugins/maxbuttons/)
* compatible with popups plugin https://es.wordpress.org/plugins/popups/
*/
add_filter( 'mb_shortcode_display_args', 'popups_maxbuttons');
function popups_maxbuttons( $args){
$args['load_css'] = 'inline';
return $args;
}
@timersys
timersys / gist:f1a32f24d99a433ec859
Last active February 5, 2016 12:39
Geotargeting Shortocdes
List of available shortcodes to Paste on a demo page
[[geot_country_code]]: [geot_country_code]
[[geot_country_name]]: [geot_country_name]
[[geot_city_name]]: [geot_city_name]
[[geot_state_name]] : [geot_state_name]
[[geot_state_code]]: [geot_state_code]
[[geot_zip]]: [geot_zip]
@timersys
timersys / functions.php
Last active February 2, 2016 14:49
Disable Mailchimp double optin and welcome email on Popups Premium plugin
<?php
/**
* Disable Mailchimp Double optin and welcome email
* in Popups premium plugin
* https://timersys.com/plugins/popups-premium/
*/
add_filter( 'spup/mailchimp/subscribe_data', 'disable_double_optin' );
function disable_double_optin( $data ){
$data['double_optin'] = false;
$data['send_welcome'] = false;
@timersys
timersys / geot-redirects.php
Last active May 2, 2017 13:19
Geotargeting redirects
<?php
use Jaybizzle\CrawlerDetect\CrawlerDetect;
/**
* Create Custom Redirects from home page only
* @link http://wp.timersys.com/geotargeting/
*
* @wordpress-plugin
* Plugin Name: GeoTargeting Pro Custom Redirects
* Plugin URI: http://wp.timersys.com/geotargeting/
* Description: Geo Targeting custom redirects
@timersys
timersys / PgCache.php
Created January 30, 2016 14:01
W3 Total Cache Modification to work with Geotargeting Pro Plugin
<?php
/**
* File to replace original W3 Total cache one located in /lib/W3/
* To make it work Page cache + Geotargeting Pro
* https://timersys.com/geotargeting/
* */
// To support legacy updates with old add-ins
if (class_exists('W3_PgCache'))
return;
@timersys
timersys / maxmind.php
Last active January 26, 2016 15:03
Maxmind shortcodes Plugin
<?php
/*
Plugin Name: Maxmind Shortcodes
Description: Using Maxmind API to display user's country with a simple shortcode
Version: 1.0.0
Author: Damian Logghe
Author URI: https://timersys.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
@timersys
timersys / single.php
Last active December 30, 2015 15:52
Geotargeting with ACF 5
<?php
/*
* A very basic example file that will use Advanced custom fields - http://www.advancedcustomfields.com/
* along with Geotargeting Pro - https://timersys.com/geotargeting/
* to display a simple image or iframe base on user Geolocation
*/
?><div id="content">
<?php /* wordpress loop */ ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@timersys
timersys / functions.php
Created November 16, 2015 12:31
Add custom html or javascript in a popup by creating a shortcode
<?php
/**
* Creates a shortcode [popups-code] that will print some html or js code
* We use buffer to capture raw html so you can paste it normally
**/
function popup_custom_code_func( $atts ) {
$atts = shortcode_atts( array(
'foo' => 'no foo',
), $atts, 'bartag' );
ob_start();?>
@timersys
timersys / functions.php
Created November 9, 2015 12:50
Redirect users to same site depending on language of polylang
<?php
/*
* Redirect user by country or state to same site using WPML
* using Geotargeting WordPress plugin . https://timersys.com/geotargeting
*/
function geot_redirects() {
// grab wpml language of current user
$lang = pll_current_language('slug');
// grab country code of current user
@timersys
timersys / gist:18fcf2c5001ffccc9cad
Created September 15, 2015 18:32
Sample code to use with custom code optin forms
<form method="post" action="" enctype="multipart/form-data" class="spu-fields-container">
<input type="hidden" name="aid" value="2122">
<input type="hidden" name="required" value="lemail,lfname">
<input type="hidden" name="filledfrm" value="mysite.htm">
<input class="spu-fields spu-name" name="lfname" size="15" type="text" placeholder="Full Name" />
<input class="spu-fields spu-name" name="lemail" size="15" type="text" placeholder="Email"
<input name="submit" type="submit" value="Subscribe" class="spu-fields spu-submit">