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
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;
@timersys
timersys / functions.php
Created Dec 14, 2017
Disable Images Loaded plugin in Popups premium javascript
View functions.php
<?php // don't include opening tag if already exist
// Popups premium disable images loaded plugin
add_filter('spu/spuvar/imagesloaded', '__return_false');
@timersys
timersys / functions.php
Created Nov 14, 2017
Enable support for WooCommerce Price Based on Country
View functions.php
<?php // don't include this line
/**
* Enable support for WooCommerce Price Based on Country and GeotargetingWP
* First enable cache mode or you will consume lot of credits.
*/
add_action( 'wc_price_based_country_before_frontend_init', 'geotwp_wcpb_set_country', 15 );
function geotwp_wcpb_set_country(){
wcpbc_set_woocommerce_country( geot_country_code() );
//trigger refresh mini cart
@timersys
timersys / functions.php
Last active Jan 29, 2018
Custom scopes with Facebook Login WordPress plugin https://timersys.com/plugins/facebook-login-pro/
View functions.php
<?php
/**
* Collect custom scopes with Facebook Login WordPress plugin
* https://timersys.com/plugins/facebook-login-pro/
**/
// Change default scopes
add_filter('fbl/app_scopes', function( $scopes ) {
return 'email,public_profile,user_posts'; // pass custom scopes
});
@timersys
timersys / popups.js
Created Jul 31, 2017
Videos on Popups plugin
View popups.js
/**
* Snippet for WordPress popup plugin
* https://wordpress.org/plugins/popups/
* Add this in your theme javascript files
*/
/**
* How to pause videos when popup is closed
* Replace 123 with your popup id
*/
You can’t perform that action at this time.