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 | |
/** | |
* Remove variouse template parts in WooCommerce | |
*/ | |
add_filter( 'wc_get_template', function( $located, $template_name, $args, $template_path, $default_path ) { | |
$remove = [ | |
'sale-flash.php', | |
'meta.php', |
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 new rewrite rule | |
*/ | |
function create_new_url_querystring() { | |
add_rewrite_rule( | |
'blog/([^/]*)$', | |
'index.php?name=$matches[1]', | |
'top' | |
); |
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 | |
/** | |
* 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 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 | |
/** | |
* AJAC filter posts by taxonomy term | |
*/ | |
function vb_filter_posts() { | |
if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'bobz' ) ) | |
die('Permission denied'); | |
/** |
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 | |
/** | |
* Display errors | |
*/ | |
if ( ! function_exists('debug_wpmail') ) : | |
function debug_wpmail( $result = false ) { | |
if ( $result ) | |
return; |
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( 'woocommerce_coupon_is_valid', function( $is_valid, $coupon ) { | |
/** | |
* Selected coupons allowed for logged in users only | |
*/ | |
if ( in_array( $coupon->get_code() , ['loggedinonly', 'anothercoupontitle']) && ! is_user_logged_in() ) | |
{ | |
return false; |
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
$('.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 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($) { | |
$doc = $(document); | |
$doc.ready( function() { | |
/** | |
* Retrieve posts | |
*/ | |
function get_posts($params) { |
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 | |
/** | |
* Shortocde for displaying terms filter and results on page | |
*/ | |
function vb_filter_posts_sc($atts) { | |
$a = shortcode_atts( array( | |
'tax' => 'post_tag', // Taxonomy | |
'terms' => false, // Get specific taxonomy terms only | |
'active' => false, // Set active term by ID |
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 | |
/** | |
* Plugin Name: Lightning Address | |
* Plugin URI: https://gist.github.com/Bobz-zg/5e8fe19442d88ddb32bae428dfc199f3/edit | |
* Author: Vlado Bosnjak | |
* Author URI: https://github.com/code-soup | |
* Description: Handle the basics with this plugin. | |
* Version: 0.0.1 | |
* Requires at least: 5.2 |
NewerOlder