Enable FTP wordpress update and plugin
define('FS_METHOD', 'direct');
Website accessability test
WooCommerce - Update cart data while user add more
add_shortcode('header_cart_count', 'header_cart_count_fn');
function header_cart_count_fn(){
global $woocommerce;
$output = '<a class="cart-customlocation" href="'.$woocommerce->cart->get_cart_url().'"><span class="fa fa-shopping-cart"></span> '.sprintf(_n('%d', '%d', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count).' - '.$woocommerce->cart->get_cart_total().'</a>';
return $output;
}
// Filter
add_filter('woocommerce_add_to_cart_fragments', function($fragments){
global $woocommerce;
ob_start();
$output = '<a class="cart-customlocation" href="'.$woocommerce->cart->get_cart_url().'">
<span class="fa fa-shopping-cart"><span> '.sprintf(_n('%d', '%d', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count).' - '.$woocommerce->cart->get_cart_total().'</a>';
echo $output;
$fragments['a.cart-customlocation'] = ob_get_clean();
return $fragments;
});
Setup post data fpr any loop
setup_postdata( $post );
// Reference: https://codex.wordpress.org/Function_Reference/setup_postdata
// $post variable along with the setup_postdata()
Useful Wordpress Conditions
post_type_exists
: Check post type