Add class to current category menu item

You can use is_category() You can check the documentation here function show_parent_categories( $args = array() ) { $args = array( ‘hierarchical’ => 1, ‘show_option_none’ => ”, ‘hide_empty’ => 0, ‘parent’ => $category->term_id, ‘taxonomy’ => ‘product_cat’ ); $product_categories = get_terms( ‘product_cat’, $args ); $count = count($product_categories); if ( $count > 0 ){ echo “<div id=’main-categories-wrapper’><ul id=’main-categories’>”; … Read more

How can I stop wp_nav_menu from returning extraneous root links?

<h1><a href=”https://wordpress.stackexchange.com/questions/241420/<?php echo home_url();?>”><?php bloginfo(‘name’); ?></h1> Soooo I forgot to close my link tag in my header. Deeerp. Lol <h1><a href=”https://wordpress.stackexchange.com/questions/241420/<?php echo home_url();?>”><?php bloginfo(‘name’); ?> </a> </h1> closing the tag fixes the issue.

Back to category link

Use echo get_cat_name( $cat ); instead of the_category() inside the link. the_category() returns a link, so you will have a link within a link.

Sort results by name & asc order on homepage

Since you only want to hook into the posts on your homepage, I think you only need something like this: <?php add_action( ‘pre_get_posts’, ‘my_change_sort_order’); function my_change_sort_order( $query ){ if ( ! is_admin() && $query->is_main_query() ) : if ( is_front_page() ) : //Set the order ASC or DESC $query->set( ‘order’, ‘ASC’ ); //Set the orderby $query->set( … Read more