So I have this code:
<?php wp_list_categories(array(
'show_option_all' => 'All Categories',
'orderby' => 'ID',
'order' => 'DESC',
'use_desc_for_title' => 0,
'child_of' => 0,
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 1,
'title_li' => NULL,
'show_option_none' => NULL,
'number' => NULL,
'taxonomy' => 'category' ));?>
And the first item, show_option_all
, produces the following link:
<li><a href="http://mywebsite.com">All Categories</a></li>
That is, it is calling index.php
or home.php
when what I would like is for it to call the category.php
template, where I would expect it to produce a link like this:
<li><a href="http://mywebsite.com/categories/all">All Categories</a></li>
Or something. Am I missing something?
Isaac, I guess this derived from the
wp_dropdown_categories()
function which is supposed to work like a filter on a page — display posts from a certain category or display posts from all categories.So
wp_list_categories
does the same but in a list of links instead of a dropdown menu, so it’s still intended to filter posts by category, meaning “All categories” will link to posts from all the available categories, which is actually “removing the filter”, thus pointing at your home page or blog page.You can create a page template to display the posts in the fashion you like and link to that page manually, disabling
show_option_all
in your function call.