wp_list_categories exclude not working

The wp_list_categories() function uses get_terms() behind the scenes, where the documentation for the exclude argument says: If $include is non-empty, $exclude is ignored. Instead you could try to exclude the term_id from the include values: $include = wp_filter_object_list( get_the_category(), // Data [ ‘term_id’ => 1 ], // Filter Data ‘NOT’, // Filter Option (exclude) ‘term_id’ … Read more

How to get the category of the post and link it to the archive (of the category)

One these three should do the job for you… 1. Function: the_category(); News su <?php the_category(‘, ‘); ?> Displays as: News su WordPress, Computers, Blogging And if only a single category is assigned to a post, it shows up like this: News su WordPress 2. Function: get_the_category_list(); <div id=”pagine”><?php echo get_the_category_list(); ?></div> Displays as: <div … Read more

How to order the get_categories result

Firstly, $product->get_categories() won’t work because it’s a woocommerce function, that basically is just a wrapper for get_the_term_list, which has no sorting parameter. It’s always good to take a look at the source to know what you’re dealing with. Secondly,get_the_term_list uses get_the_terms, but it also has no sorting parameter. The latter get the terms either from … Read more

Exclude one category from get_the_term_list

By default you can’t exclude terms from get_the_term_list. However, you can tweak the original function and make it exclude terms. The original function can be found in wp-includes/category-template.php lines 1277 to 1306. Add this to your functions.php. This new function, as said will exclude any term you specify <?php function get_modified_term_list( $id = 0, $taxonomy, … Read more