If we have a website which is largely text based, something like this website which shows mostly text posts then its always better to have a home page which lists all the categories so user can choose the category they want and we display the posts under that category on next category pages.
For getting the list of categories, wordpress provides an API “wp_list_categories” using which we can get the list of all categories. This API also accepts an arguments which can be used to customise look and features of category listing. To add categories on home page modify your wordpress based websites source code as below,
<?php if ( is_home() || is_front_page() ) : ?> <?php wp_list_categories(array( 'hierarchical' => false, 'style' => 'list', 'separator' => '<hr>', 'depth' => '2', 'order' => 'ASC', 'orderby' => 'name', 'show_count' => true ) ); ?> <?php endif; ?>
details of more supported arguments for “wp_list_categories” can be found at wordpress website ( Link ).
If you want to display subcategories on navigation pages, you can visit our post “Display all subcategories from a specific category on selected Category Archive page ?”