This file contains hidden or 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 | |
/** | |
* Place this part of code somewhere in functions.php | |
*/ | |
add_filter( 'posts_where' , function($q) { | |
global $wpdb; | |
$r = "AND ({$wpdb->posts}.post_password = '')"; | |
$q = str_replace($r, '', $q); |
This file contains hidden or 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
$('.play').click( function(event) { | |
if(event.preventDefault) { event.preventDefault(); } | |
$video = $(this).closest('iframe'); | |
if ( $video.hasClass('wistia_embed') ) { | |
window._wq = window._wq || []; | |
$video_id = /[^/]*$/.exec( $video.attr('src') )[0]; | |
This file contains hidden or 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
add_action( 'init', function () { | |
wp_oembed_add_provider( '/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/.*/', 'http://fast.wistia.net/oembed', true ); | |
}); |
This file contains hidden or 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 | |
/** | |
* Pre-populate Woocommerce checkout fields | |
* Note that this filter populates shipping_ and billing_ fields with a different meta field eg 'first_name' | |
*/ | |
add_filter('woocommerce_checkout_get_value', function($input, $key ) { | |
global $current_user; | |
switch ($key) : |
This file contains hidden or 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
<a href="#toggleMe" data-toggle="toggleMe">Toggle div</a> | |
<div id="toggleMe" class="toggler"> | |
Content goes here ... | |
</div> |
This file contains hidden or 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
.toggler { | |
overflow: hidden; | |
max-height: 0; | |
transition: max-height .3s ease-in; | |
} | |
.toggler.active { | |
max-height: 2000px; | |
transition: max-height .3s ease-out; | |
} |
This file contains hidden or 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
$.fn.toggler = function() { | |
return this.each( function() { | |
$(this).click(function(event) { | |
// Prevent click event on a tag | |
if ($(this).is('a')) { | |
if(event.preventDefault) { event.preventDefault(); } | |
} |
This file contains hidden or 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
(function($) { | |
function triggerError($err, $status) { | |
$msg = false; | |
$errors = { | |
'e100' : "Something went wrong, please try again later", | |
'e101' : "Please enter you'r username and password", | |
'e102' : "Please enter you'r email", | |
'e103' : "Please populate all fields marked with *", |
This file contains hidden or 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 | |
/** | |
* Check if term exists | |
*/ | |
if (!is_array($terms)) : | |
$response = [ | |
'status' => 501, | |
'message' => 'Term doesn\'t exist', | |
'content' => 0 | |
]; |
This file contains hidden or 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 | |
function vb_filter_posts_mt() { | |
if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'bobz' ) ) | |
die('Permission denied'); | |
/** | |
* Default response | |
*/ | |
$response = [ |