Skip to content

Instantly share code, notes, and snippets.

Damian timersys

Block or report user

Report or block timersys

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@timersys
timersys / geot.php
Created Jan 20, 2020
Disable GeotargetingWP Sessions
View geot.php
<?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
Created Dec 16, 2019
GeotargetingWP PHP functions
View functions.php
<?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 Dec 3, 2019
custom shortcode to insert javascript
View functions.php
// 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 Oct 18, 2019
Cancel post geotargeting on certain pages
View functions.php
<?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;
View functions.php
<?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>';
}
View functions.php
<?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>
View functions.php
<?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>
@timersys
timersys / functions.php
Created Jul 9, 2018
Open popup after submitting contact form 7
View functions.php
<?php
// 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>
document.addEventListener( 'wpcf7mailsent', function( event ) {
@timersys
timersys / functions.php
Last active Mar 7, 2018
Pass custom data to GeotargetingWP plugins instead of the API
View functions.php
<?php
/**
* If you want to cancel API calls for any reason or to pass custom that you can use the following
* filter. Note that we use json_decode(json_encode to pass an object instead of an array
**/
// Cancel query only for admins
add_filter('geot/cancel_query', function() {
if( ! current_user_can('administrator') )
return false;
@timersys
timersys / functions.php
Last active May 10, 2018
Change WpRocket cache level for Geotargeting WP or disable it
View functions.php
<?php
/**
* By default WpRocket plugin will create different cache pages at a country level
* To add more levels (states or cities) you need to add the following filter
*/
add_filter('rocket_geotargetingwp_enabled_cookies', function($enable){
$enable[] = 'state';
//$enable[] = 'city';
return $enable;
You can’t perform that action at this time.