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 | |
/** | |
* Order product collections by stock status, instock products first. | |
*/ | |
class iWC_Orderby_Stock_Status | |
{ | |
public function __construct() | |
{ |
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 | |
//additional_shipping_fee | |
//add_action( 'woocommerce_cart_calculate_fees', 'bbloomer_add_cart_fee' ); | |
function bbloomer_add_cart_fee() { | |
$surcharge = 2; // 5% surcharge based on shipping cost | |
WC()->cart->add_fee( __('Handling', 'woocommerce'), $surcharge ); |
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 | |
// custom excerpt length | |
function my_custom_excerpt_length( $length ) { | |
return 40; | |
} | |
add_filter( 'excerpt_length', 'my_custom_excerpt_length', 999 ); | |
// add more link to excerpt | |
function my_custom_excerpt_more($more) { |
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 my_custom_shortcode() { | |
ob_start(); | |
get_template_part('custom_shortcode'); // get file custom_shortcode.php in your theme | |
return ob_get_clean(); | |
} | |
add_shortcode( 'my_custom_shortcode', 'my_custom_shortcode' ); | |
// shortcode to use [my_custom_shortcode] |
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( 'template_redirect', 'woo_custom_redirect_after_purchase' ); | |
function woo_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && !empty( $wp->query_vars['order-received'] ) ) { | |
wp_redirect( 'https://escatech.us/new-order-thankyou/' ); | |
exit; | |
} | |
} |
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 | |
/* | |
* Enable COD for account holder | |
*/ | |
function enable_cod_payment( $available_gateways ) { | |
global $woocommerce; | |
$user = wp_get_current_user(); | |
$user_status = get_field('account_holder', $user ); |
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
jQuery(function ($) { | |
$("#additional_Shipping_Method").change(function() { | |
var val = $(this).val(); | |
if (val === "third-party") { | |
$("#additional_Carrier_Name_field").show(); | |
$("#additional_Carrier_Account_Number_field").show(); | |
} | |
else if (val === "collect") { | |
$("#additional_Carrier_Name_field").show(); |
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 | |
$current_user = wp_get_current_user(); | |
$site_address = get_option( 'siteurl' ); | |
if ( is_user_logged_in() ) { | |
echo '<a href="' . $site_address . '/my-account/customer-logout/">Logout</a>'; | |
echo '<a href="' . $site_address . '/my-account/">' . $current_user->user_email . '</a>'; | |
} else { | |
echo '<a href="' . $site_address . '/my-account/">Login</a>'; | |
} |
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 | |
$slider = new WP_Query(array( 'post_type' => 'project' ) ); | |
if( $slider->have_posts() ) : | |
while($slider->have_posts()) : | |
$slider->the_post(); | |
?> | |
<style type="text/css"> | |
.project-box { | |
background-image: url('<?php the_field('featured_image') ?>'); |
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 | |
if ( have_rows( 'care_levels' ) ): | |
echo '<div class="carelevels-slider">'; | |
while ( have_rows( 'care_levels' ) ): the_row(); | |
?> | |
<div class="carelevels-slide"> | |
<?php | |
// content |