Pergunta

<?php echo get_the_category_list(); ?> not give me all my categories.

I use <?php echo get_the_category_list(); ?> in my footer.php file to display my categories but in home page show only two categories and in inner single posts show post's related category and in pages show nothing. even I use <?php wp_reset_query(); ?> after each WP_Query

please help me

Foi útil?

Solução

You can use

<ul>
<?php wp_list_categories('exclude=22&title_li='); ?>
</ul>

Outras dicas

$categories = get_categories($args);
$html       = '<ul>';
foreach($categories as $cat){
$html .= '<li><a href="'.get_permalink($cat->term_id);.'"';
$html .= '<h2>'.$cat->cat_name.'</h2>'; 
$html .= '</a></li>';
}
$html .= '';
return $html;`

in your function

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top