Support » Fixing WordPress » Listing Categories and Sub Category titles with links

  • Hey there,

    I want to list all the categories that I have on one page and when the user clicks on any of the category names he will be taken to all the sub categories.

    On clicking on the sub-category the will be a list of all post in that sub-category.

    Consider the following category and sub category structure

    chapter 1
    lesson 1
    lesson 2
    lesson 3
    chapter 2
    chapter 3

    I am using the following plugin which lists only posts in a category.
    https://wordpress.org/plugins/list-category-posts/

    Is there a plugin that does what I want?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Are you saying you want the posts inside that sub category to show? or just list all of the categories?

    I’m not sure of a plugin but if you are familiar with PHP you could achieve this with some core WP functions.

    If you are trying to just list all of the categories you can use ‘wp_list_categories’ https://developer.wordpress.org/reference/functions/wp_list_categories/.

    Once you hit the single page you could swap out the sidebar for one that shows the posts in the category you are in using with ‘get_posts’ which will require a little more PHP to make the list.
    https://codex.wordpress.org/Template_Tags/get_posts

    Also, if the categories and posts wont change much you could always make a Menu and include it in your sidebar

    Thanks for the reply.
    I got it working using the following plugin https://wordpress.org/plugins/list-categories/

    which does the same thing you said.

    Another issue that I am facing is this. I have a lot of sub categories. So I want to just list a few and have a more button when the user clicks on it, it will take him to a page where all categories are listed.

    Is there a way to limit the result that comes back?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Listing Categories and Sub Category titles with links’ is closed to new replies.