Output a Custom Taxonomy Loop in WordPress

Output Custom Taxonomy Terms

Here is a custom taxonomy loop code snippet, which allows you to output a set of custom taxonomy terms using the get_terms object and a foreach loop. <?php // Taxonomy Loop /** * Get the Custom Taxonomy * For a list of other parameters to pass in see link below * @link https://developer.wordpress.org/reference/classes/wp_term_query/__construct/ * For…

Read More

Add a CSS class on a current active menu item

Add Css Class Active Menu

With manual menus you may need to add a CSS class to the current menu item that is active, below is a jQuery solution, that utilizes the URL of the page to match the link and add the CSS. (function($){ $(function() { // Document Ready activeMenu(); }); // Functions // @link https://stackoverflow.com/questions/4866284/jquery-add-class-active-on-menu function activeMenu() {…

Read More

Create a Login/Logout Link in WordPress

set wordpress logout url

To create a login/logout link in WordPress you can use a snippet of php code using the wp_logout_url function, you can also set the logout URL to be an external site to your own. <?php if (is_user_logged_in()) : ?> <a href=”<?php echo wp_logout_url(get_permalink()); ?>”>Logout</a> <?php else : ?> <a href=”<?php echo wp_login_url(get_permalink()); ?>”>Login</a> <?php endif;?>

Read More

WooCommerce, Add Short or Long Description to Products on Shop Page

Add Description Product Shop Woocommerce

You can add a WooCommerce products’ long or short description to the actual product on the main shop page in WooCommerce via the woocommerce_after_shop_loop_item_title action hook, this hook places content immediately after the product title. Adding the Long Description to the Product Loop on the Shop page add_action( ‘woocommerce_after_shop_loop_item_title’, ‘wc_add_long_description’ ); /** * WooCommerce, Add…

Read More

Remove the Additional Information and Order Notes fields in WooCommerce

remove order notes field woocommerce

You can remove the Additional Information and Order Notes fields in WooCommerce checkout page with 2 filters that you add to your themes functions.php file // Removes Order Notes Title – Additional Information & Notes Field add_filter( ‘woocommerce_enable_order_notes_field’, ‘__return_false’, 9999 ); // Remove Order Notes Field add_filter( ‘woocommerce_checkout_fields’ , ‘remove_order_notes’ ); function remove_order_notes( $fields ) {…

Read More