Set current URL as the Canonical URL and ignore query strings

add_filter( ‘aioseo_canonical_url’, ‘aioseo_filter_canonical_url’ ); function aioseo_filter_canonical_url( $url ) { if (strpos($_SERVER[‘REQUEST_URI’],’/home-search/listing/’) !== false) { $url = home_url( $_SERVER[‘REQUEST_URI’] ); if (strpos($url,’?’) !== false){ $url = substr( $url, 0, strpos($url,’?’) ); } } return $url; }Continue reading

Limit Meta Description to 160 characters

add_filter( ‘aioseo_description’, ‘aioseo_filter_description’ ); function aioseo_filter_description( $description ) { if ( strlen($description) > 160 ) { $description = substr($description, 0, 159); } return $description; }Continue reading

Tyler Hall Tech Custom Snippets (copy)

// Custom PHP Code by Tyler (TITLE) function page_title_sc( ){ return get_the_title(); } add_shortcode( ‘page_title’, ‘page_title_sc’ ); // Enable Shortcode Execution in Text Widgets add_filter( ‘widget_text’, ‘do_shortcode’ ); // Disable Gutenberg Editor (use Classic Editor) add_filter(‘gutenberg_can_edit_post’, ‘__return_false’, 5); add_filter(‘use_block_editor_for_post’, ‘__return_false’,…Continue reading

Add empty cart class to Body

add_filter(‘body_class’, ‘stw_add_cart_status_class’); function stw_add_cart_status_class($classes) { if (function_exists(‘WC’)) { $cart = WC()->cart; if (isset($cart) && is_callable(array($cart, ‘get_cart_contents_count’))) { $items = $cart->get_cart_contents_count(); $classes[] = $items?’cart_has_items’:’cart_is_empty’; } } return $classes; }Continue reading

Third Party – Cart Mods

function filter_woocommerce_cart_item_class( $string, $cart_item, $cart_item_key ) { // Get the product categories slugs for this item $term_slugs = wp_get_post_terms( $cart_item[‘product_id’], ‘product_cat’, array( ‘fields’ => ‘slugs’ ) ); // NOT empty if ( ! empty ( $term_slugs ) ) { $string…Continue reading

Third Party Invoice List Page

//shortcode for total of items in cart – no shipping/taxes/etc. add_shortcode( ‘quote-total’, ‘get_quote_total’ ); function get_quote_total(){ $total = WC()->cart->total; return wc_price($total); }Continue reading