Domanda

<?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

È stato utile?

Soluzione

You can use

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

Altri suggerimenti

$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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top