Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #867411

    Hi,
    How do I display post categories instead of posts ? ( I am not using woocommerce)

    Thanks,

    • This topic was modified 7 years, 2 months ago by kagitvs.
    #867423

    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

    #868252

    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,

    #868536

    Hi,

    Can you post the link to the page mentioned? so we can visualize what you want to accomplish.

    Best regards,
    Nikko

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.