Hi,
How do I display post categories instead of posts ? ( I am not using woocommerce)
Thanks,
Hey kagitvs,
Try adding this php code at the bottom of functions.php:
function list_categories_fn( $atts ) {
$cat = '<ul>';
$cat .= wp_list_categories( array(
'orderby' => 'name',
'title_li' => ''
) );
$cat .= '</ul>';
return $cat;
}
add_shortcode( 'list_categories', 'list_categories_fn' );
then on your page just use this shortcode:
[list_categories]
This should list all your categories. Hope this helps :)
Best regards,
Nikko
Thanks, but what I am actually looking for is,
how to display Post Categıries when we click on a category on a menu. ( itdisplays all the posts listed in that category as default. But I want to display subcategories under taht category first instead of the posts . ( Just like product categories instead of all products in woocommerce. But I am not using woocommerce, I need this for posts and posts categories.)
Best Regards,
Hi,
Can you post the link to the page mentioned? so we can visualize what you want to accomplish.
Best regards,
Nikko