Skip to content

Instantly share code, notes, and snippets.

@timersys
timersys / functions.php
Last active February 9, 2016 17:17
Redirect users to same site depending on language
<?php
/**
* Create Custom Redirects
* @link https://timersys.com/geotargeting/
*
* @wordpress-plugin
* Plugin Name: GeoTargeting Pro Custom Redirects
* Plugin URI: https://timersys.com/geotargeting/
* Description: Geo Targeting custom redirects
* Version: 1.0.0
@timersys
timersys / functions.php
Last active September 29, 2015 12:04
Redirect user by country or state to a different site
<?php
/*
* Redirect user by country or state to a different site
* using Geotargeting WordPress plugin . https://timersys.com/geotargeting
*/
// if some functions such as is_front_page are not working change hook to a later one like template_redirect
add_action( 'init', 'geot_redirect' );
function geot_redirect() {
if( ! function_exists( 'geot_target') )
@timersys
timersys / functions.php
Created September 11, 2015 17:47
how to disable akismet in Gravity forms
<?php
// disable akismet in all Gravity forms
add_filter( 'gform_akismet_enabled', '__return_false' );
// disable in just one form - Replace ## with your form ID
add_filter( 'gform_akismet_enabled_##', '__return_false' );
@timersys
timersys / functions.php
Last active April 1, 2016 11:22
Change or remove "powered by Wordpress Social Invitations" text
<?php
/*
* Change or remove "powered by Wordpress Social Invitations" text
* https://wordpress.org/plugins/wp-social-invitations/
*/
add_filter( wsi/powered_by', 'custom_powered_wsi' );
function custom_powered_wsi( $text ) {
$text = 'new text';
return $text;
}
@timersys
timersys / functions.php
Last active May 16, 2018 14:21
Change geot IP for local development
<?php
/**
* Geotargeting Plugin. https://wordpress.org/plugins/geotargeting/
* Filter IP if you are for example in local host
*/
add_filter( 'geot/user_ip', 'geot_ip');
function geot_ip( $ip ) {
return '192.192.192.192';
}
@timersys
timersys / script.js
Last active August 29, 2015 14:21
Custom conversions links on Wordpress Popups Plugin
jQuery( function($){
var spu_id = 120; // Replace with your own popup ID
/**
* Custom conversions links on Wordpress Popups Plugin
* http://wordpress.org/plugins/popups/
* On this example your popup id is 120
* */
jQuery('#spu-'+spu_id+' a:not(".spu-close-popup")').on('click', function(){
// Track the popups. Uncomment only if you are using premium version
//window.SPU.track(spu_id, true);
function TinyMceOptin() {
SPUP_ADMIN.spu_editor = $("#content_ifr").contents().find('html #tinymce');
var spu_box_container = false;
// If there is not content add some
var content = SPUP_ADMIN.spu_editor.text();
if( SPUP_ADMIN.spu_editor.find('.spu-box-container').length) {
spu_box_container = true;
content = SPUP_ADMIN.spu_editor.html();
}
@timersys
timersys / functions.php
Created May 5, 2015 19:33
Filter Wordpress popup content
<?php
/**
* IF you want to filter popups content to add custom content
* http://wordpress.org/plugins/popups/
**/
add_filter('spu/popup/content', 'add_gf_to_spu', 10, 2);
function add_gf_to_spu( $content, $popup){
// Check if the popup is the correct one
if( $popup->ID == ID_NUMBER_HERE ){
if ( is_page(THE_PAGE_YOU_WANT) ) {
@timersys
timersys / functions.php
Created April 16, 2015 12:22
Remove Wordpress social invitations WSI from buddypress tab
/**
* Remove Wordpress social invitations WSI from buddypress tab
*/
add_action('bp_setup_nav' ,'remove_wsi_hooks');
function remove_wsi_hooks(){
bp_core_remove_nav_item('wp-social-invitations');
}
@timersys
timersys / popups.js
Created April 14, 2015 13:25
Wordpress Popups Javascript events
/**
* Popups plugin - Javascript Events https://wordpress.org/plugins/popups/
**/
jQuery(document).on('spu.box_close',function(e,id){ ... });
jQuery(document).on('spu.box_open',function(e,id){ ... });
jQuery(document).on('spu.form_submitted',function(e,id){ ... });