This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.getJSON('http://freegeoip.net/json/', function(location) { | |
var d = new Date(), | |
curr_date = d.getDate(), | |
curr_month = d.getMonth(), | |
curr_year = d.getFullYear(), | |
fulldate = curr_date + "-" + curr_month + "-" + curr_year; | |
$('<input id="date" type="hidden" name="custom_date" value="' + full_date + '" />').appendTo($('#your-form-id-here')); | |
$('<input id="ip" type="hidden" name="custom_ip" value="' + location.ip + '" />').appendTo($('#your-form-id-here')); | |
$('<input id="country" type="hidden" name="custom_country" value="' + location.country_name + '" />').appendTo($('#your-form-id-here')); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'tgmsp_youtube_query_args', 'tgm_soliloquy_remove_youtube_controls' ); | |
function tgm_soliloquy_remove_youtube_controls( $query_args ) { | |
$query_args['controls'] = '0'; | |
return $query_args; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
$(document).on('OptinMonsterInit', function(event, data){ | |
// If video is playing (add your own logic here), remove the optin. | |
if ( data.optin ) { | |
$('#om-' + data.optin).remove(); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
$(document).on('OptinMonsterOptinSuccess', function(event, data){ | |
// An optin has been processed. You can send this information to GA for analytics. | |
console.log(data); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'edd_add_to_cart_item', 'tgm_cp_add_to_cart_item' ); | |
add_filter( 'edd_ajax_pre_cart_item_template', 'tgm_cp_add_to_cart_item' ); | |
function tgm_cp_add_to_cart_item( $cart_item ) { | |
if ( ! empty( $_POST['post_data'] ) ) { | |
$post_data = array(); | |
wp_parse_str( $_POST['post_data'], $post_data ); | |
if ( isset( $post_data['envira-custom-price'] ) ) { | |
$cart_item['options']['custom_price'] = edd_sanitize_amount( $post_data['envira-custom-price'] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'optin_monster_cap', 'tgm_om_editor_cap' ); | |
function tgm_om_editor_cap( $cap ) { | |
// Replace with the relevant capability needed for your editors. | |
return 'edit_others_posts'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'optinmonster_output', 'tgm_om_hide_optins' ); | |
function tgm_om_hide_optins( $optins ) { | |
// Return an empty array if no user is logged in. Change this to your logic for determining where customers come from. | |
if ( ! is_user_logged_in() ) { | |
return array(); | |
} | |
// Return the potentially modified optins. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'soliloquy_api_on_load', 'tgm_soliloquy_autoplay_vimeo_on_load' ); | |
function tgm_soliloquy_autoplay_vimeo_on_load( $data ) { | |
ob_start(); | |
?> | |
var slide_video = soliloquy_<?php echo $data['id']; ?>.find('.soliloquy-item:not(.soliloquy-clone):eq(' + currentIndex + ') .soliloquy-video-icon'); | |
if ( slide_video.length > 0 ) { | |
var video_type = slide_video.data('soliloquy-video-type'); | |
if ( 'vimeo' == video_type ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'soliloquy_api_on_load', 'tgm_soliloquy_autoplay_youtube_on_load' ); | |
function tgm_soliloquy_autoplay_youtube_on_load( $data ) { | |
ob_start(); | |
?> | |
var slide_video = soliloquy_<?php echo $data['id']; ?>.find('.soliloquy-item:not(.soliloquy-clone):eq(' + currentIndex + ') .soliloquy-video-icon'); | |
if ( slide_video.length > 0 ) { | |
var video_type = slide_video.data('soliloquy-video-type'); | |
if ( 'youtube' == video_type ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'soliloquy_api_on_load', 'tgm_soliloquy_autoplay_wistia_on_load' ); | |
function tgm_soliloquy_autoplay_wistia_on_load( $data ) { | |
ob_start(); | |
?> | |
var slide_video = soliloquy_<?php echo $data['id']; ?>.find('.soliloquy-item:not(.soliloquy-clone):eq(' + currentIndex + ') .soliloquy-video-icon'); | |
if ( slide_video.length > 0 ) { | |
var video_type = slide_video.data('soliloquy-video-type'); | |
if ( 'wistia' == video_type ) { |
OlderNewer