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 | |
//define fallback image path | |
$thumb = get_template_directory_uri().'/images/fallback-image.jpg'; | |
if ( has_post_thumbnail() ) { | |
//override fallback image if post has any thumbnail | |
$thumb = get_the_post_thumbnail_url(); | |
} | |
?> | |
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 | |
if ( have_rows( 'care_levels' ) ): | |
echo '<div class="carelevels-slider">'; | |
while ( have_rows( 'care_levels' ) ): the_row(); | |
?> | |
<div class="carelevels-slide"> | |
<?php | |
// content |
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 | |
$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 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 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 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 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 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 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 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 ); |