Automatically add product_categories to nav_menu

put this on your functions.php and then call the function in whatever page desired. this code is prepare to use css. if (! function_exists(‘menu_categories’)) { function menu_categories(){ $cat_args = array( ‘orderby’ => ‘name’, ‘order’ => ‘asc’, ‘hide_empty’ => true); $cats = get_terms( ‘product_cat’, $cat_args ); ?> <h1>Categories</h1><?php foreach ($cats as $key => $cat): if ($cat->parent … Read more

Redirect category to first available child post

I had to do that, but only in some categories in my site. This was the code I used – I put it in my theme’s functions.php: // use template_redirect action: add_action( ‘template_redirect’, ‘my_redirect_to_post’ ); /// Function to redirect from certain category pages to first post of those categories function my_redirect_to_post() { if (is_category(‘3’) || … Read more

Multi-site or categories?

Categories are meta data for n:n relations: Each category can be related to multiple posts, and each post to multiple categories. So categories aren’t what you need. I would set up a multi site installation. Use the main site for everything related to all sub sites and the subdomains or sub blogs for each section. … Read more

How can we get Catergory / Term Creator

By “creator” you mean the user who created the category? If so, that information is not stored by WordPress. You would have to write your own function for storing the user on category insert, maybe by hooking into the create_term function.

Category List With Comma & Link

You can use the_category if you are in the loop: <?php the_category(‘, ‘); ?> If not, then use this code: <?php $output=””; foreach((get_the_category()) as $category) { if($category->name==$homecat) continue; $category_id = get_cat_ID( $category->cat_name ); $category_link = get_category_link( $category_id ); if(!empty($output)) $output .= ‘, ‘; $output .= ‘<span class=”cat”><a href=”‘.$category_link.'”>’.$category->cat_name.'</a></span>’; } echo $output; ?>