• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Template To List All Child or Sub Categories of One Parent Category in Genesis

This template enables you to display a list of all child categories for the one parent category and updates dynamically after you add more child categories to any existing or new parent category.

Update : Here’s another solution List Child Categories of Parent Category With Image

A member of WP Sites asked me this question which is the reason i worked out this solution and wrote the tutorial:

I would like to understand how I can add create a page displaying a list of specific subcategories. I’m using the Magazine Pro theme by StudioPress.

Here’s the code for logged in members:

Register for full access

Related Code

  • Show All Tagged Posts On 1 Page With Equal Height
  • List Child Categories of Parent Category With Image
  • Add Image Upload To Edit Category Page
  • Display Posts From Specific Child Categories
  • Display Sub Categories On Parent Category Page

Child / Sub Categories

Reader Interactions

Comments

  1. officethug says

    January 13, 2016 at 10:46 am

    Brad, this is great – thank you!

    How do I move the Title under the image so it looks like a caption?
    And how do I add the Page title to the top of the page?

    Log in to Reply
    • Brad Dalton says

      January 13, 2016 at 10:55 am

      Zac

      Which code snippet did you use and what exactly do you want to do because there maybe a better solution?

      Log in to Reply
      • officethug says

        January 13, 2016 at 11:07 am

        Thanks Brad. I am trying to create a portfolio within Genesis with a grid layout. I want the PORTFOLIO page to display the thumbnail and title for each of the child categories in portfolio. If you click on a child category I want that page to display the children for that category or if there are no children, display the posts in that category. I think the solution here will work well but if you have any other ideas I would love your help.

        Log in to Reply
        • Brad Dalton says

          January 13, 2016 at 11:13 am

          Did you use the first code snippet or other one?

          Log in to Reply
        • Brad Dalton says

          January 13, 2016 at 11:33 am

          Try this code which adds the page title.

          add_action( 'genesis_loop', 'genesis_standard_loop', 5 );

          Also, change the class to entry. Otherwise, there are other solutions.

          I think the image is added via the plugin?

          Log in to Reply
          • officethug says

            January 13, 2016 at 6:05 pm

            Brad, thanks again for your help. The code to display the page title worked and the plugin worked for the images. The grid layout is there too so the only thing left is moving the Category names below the images. I tried changing the class to Entry but that just made the font big so I switched it back to entry-title. Here is the page if you want to see what I mean: http://zakyoung.com/av/materials/

          • Brad Dalton says

            January 14, 2016 at 1:30 am

            Can’t you simply reposition the entry title. Here’s an example, simply change the hook position

            Or

            You could add the remove action and add action inside a custom function.

            Here’s a more specific solution http://wpsites.net/web-design/reposition-featured-image-on-any-genesis-archive-page/

            You can also try something like this:

            remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
            add_action( 'genesis_entry_footer', 'genesis_do_post_title', 5 );
  2. Cathie says

    June 3, 2015 at 5:27 pm

    Is it possible to add the ability for it to automatically figure out the parent ID based on the url slug (or other item) so that it one code will work regardless of which archive taxonomy is being called?

    ie. if in the photography category it will pull up: newborn, family etc but if its the paint category it will pull up: matt, gloss, etc.

    This way it means that I don’t have to write this specifically for each category and it can instead just realise, yes I’m on an archive that has child taxonomies and list them with links.

    Thanks,
    Cathie.

    Log in to Reply
    • Brad Dalton says

      June 4, 2015 at 8:12 am

      Help Cathie

      Sorry but don’t follow. Please clarify what you want.

      Log in to Reply
      • Cathie says

        June 4, 2015 at 1:50 pm

        Sorry I wasn’t clear. Above you’ve manually set category ‘3’, is there a way to automatically get the parent category ID, depending on the page you’re on? So for example if I’m in the parent and also any child category of ‘photography’ it would output the list automatically of ‘family photography’ and ‘newborn photography’.

        This way we don’t have to manually set which categories have children, but that it can automatically figure out .. is this taxonomy archive one that has children .. if so, output relevant child taxonomies within that hierarchy.

        Thanks.
        Cathie.

        Log in to Reply
        • Brad Dalton says

          June 4, 2015 at 2:13 pm

          The code only generates 1 template for child categories of one parent category. The Codex doesn’t provide any examples of the values you can use for each parameter therefore its hard to say how or which parameter to modify and which value to use so the template displays all sub categories from all parent categories, if thats what you want it to do.

          Here’s the 2 parameters you can try modifying:

          child_of

          (integer) Display all categories that are descendants (i.e. children & grandchildren) of the category identified by its ID. There is no default for this parameter. If the parameter is used, the hide_empty parameter is set to false.

          parent

          (integer) Display only categories that are direct descendants (i.e. children only) of the category identified by its ID. This does NOT work like the ‘child_of’ parameter. There is no default for this parameter. [In 2.8.4]

          Log in to Reply
  3. marcomancosu says

    February 22, 2015 at 10:28 am

    Hi Brad, thanks for this tutorial! It works fine. But would it be possible to display a thumbnail image for each subcategory? I tried using plugins to add images to taxonomies (Taxonomy Images: https://wordpress.org/plugins/taxonomy-images/; Genesis Taxonomy Images: https://wordpress.org/plugins/genesis-taxonomy-images/) but the thumbnail is not displayed.
    I guess I need to change the php code in the template but I don’t know how. I read here that it’s possible though: https://wordpress.org/support/topic/plugin-taxonomy-images-thumbails-with-subcategory-list.

    Log in to Reply
    • Brad Dalton says

      February 22, 2015 at 8:17 pm

      Updated the tutorial with the code for the images.

      You can use CSS to display them in a grid.

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.