Skip to content

Instantly share code, notes, and snippets.

@timersys
timersys / class-geot-dropdown-widget.php
Created August 26, 2020 20:56
Custom ZIP switcher for GeotargetingWP
<?php
/**
* Adds GeoTarget Widget
* @since 1.0.0
*/
class GeotS_Widget extends WP_Widget {
/**
* Register widget with WordPress.
@timersys
timersys / geot-wprocket.php
Created April 13, 2020 14:12
Tiny plugin to enable State cache to Wp Rocket + GeotargetingWP
<?php
/**
* Plugin Name: Wp Rocket + GeotargetingWP States
* Plugin URI: https://geotargetingwp.com
* Description: Enable states cache for WPRocket.
* Author: timersys
* Author URI: https://geotargetingwp.com
*/
/**
@timersys
timersys / wppopups-lists.php
Created February 18, 2020 08:25
How to add your email to multiple newsletter lists
<?php
/**
* Plugin Name: WP Popups newsletter lists
* Plugin URI: https://wppopups.com
* Description: Beginner friendly WordPress popup builder plugin.
* Author: timersys
* Author URI: https://wppopups.com
* Version: 1.0.0
*/
add_filter( 'wppopups/newsletter/subscribe_data', function($data) {
@timersys
timersys / geot.php
Created January 20, 2020 15:01
Disable GeotargetingWP Sessions
<?php
/**
* Plugin Name: Disable GeotargetingWP Sessions
* Plugin Author: Damian Logghe
*/
// disable geotwp sessions
add_filter( 'geot/sessions/start_session', '__return_false');
@timersys
timersys / functions.php
Last active October 28, 2021 12:46
GeotargetingWP PHP functions
<?php
/**
* geot_target()
*
* Main function that return true or false depending if current user
* target the given countries
*
* @param string/Array $country - Pass an array of countries ,country name or country code
* @param string $country_region - Region name
* @param string $exclude/Array -Pass an array of countries ,country name or country code
@timersys
timersys / functions.php
Created December 3, 2019 14:50
custom shortcode to insert javascript
// insert javascript into WordPress posts or popups
// use shortcode [wpp_insert]
add_shortcode( 'wpp_insert', 'wpp_insert_code' );
function wpp_insert_code() {
ob_start();
?>
<!-- paste your html and javascript here -->
<?php
$html = ob_get_clean();
return $html;
@timersys
timersys / functions.php
Created October 18, 2019 17:20
Cancel post geotargeting on certain pages
<?php
// cancel geotargeted posts on certain pages
add_filter('geot/cancel_posts_where', 'geotwp_cancel_geo' );
function geotwp_cancel_geo( $query ) {
// cancel for every page that is not search
if( ! is_page('search') ) {
return true;
<?php // don' add this tag
// Open popup after WpForms submission
add_action( 'wpforms_process_complete_534', 'spu_popup_trigger' );
function spu_popup_trigger(){
add_action('wp_footer','spu_open_popup',99);
}
function spu_open_popup(){
echo '<script>setTimeout(function(){SPU.show(529)},1000);</script>';
}
<?php // don't add this tag
// Print javascript code in the footer of the site to trigger the popup upon form submission
add_action('wp_footer', 'add_popups_trigger_code',150 );
function add_popups_trigger_code(){
// show code on certain page, comment out to print code on every page
if( ! is_page(520) )
return;
?>
<script>
<?php // don't add this tag
// Print javascript code in the footer of the site to trigger the popup upon form submission
add_action('wp_footer', 'add_popups_trigger_code',150 );
function add_popups_trigger_code(){
// show code on certain page, comment out to print code on every page
if( ! is_page('520') )
return;
?>
<script>