Display sub-subcategories on subcatgory results page

When you click on a category you get the listings for that category and also it's subcategories at the top that you can click on to go to the subcategory. On the subcategory page though, you don't get the sub-subcategories listed. By this I mean the subcategories (3rd level) within the subcategories (2nd level). I want the user to have the option to click on a sub-subcategory and go down to the next level and get more specific results. Does anyone know if it's possible to list the sub-subcategories on the subcategories listing page or has anyone found a way round it? Any advice appreciated.

Created: August 27, 2015 at 8:22 am
  • In: General Discussion
  • Started by: Janak
  • 5 members left 15 comments
  • Last reply from: Hemanta ChakladarHemanta Chakladar

  • Janak
    August 27, 2015 at 10:59 am

    Just to add I’ve managed to do it but only by modifying a core file so could do with finding another solution.

    I modified the function gallerypage_results_before in file.

    I haven’t set up a child theme yet as I’m just playing around with the RT theme before new version comes out. I believe you can include functions in child themes so does anyone know if it’s possible to include this change in a child theme?

  • Janak
    September 2, 2015 at 6:42 am

    Can anyone confirm I can do this in a child theme (see above).
    @Mark, if you are around could you please confirm.

  • Joel
    September 4, 2015 at 8:26 pm

    Dear Janak

    You could give me the section of code that you modified, because I require to do the same.

    best regards

  • Hemanta Chakladar
    Hemanta Chakladar
    September 4, 2015 at 9:15 pm

    Yes, it can be added from by hooks/filter

    Give me the code, you modified, so I will try to add it in

  • Janak
    September 4, 2015 at 10:02 pm

    @Joel, @Hemanta

    Here is the procedure in

    [code title=””]function gallerypage_results_before(){ global $CORE, $category, $canShowExtras;

    if(isset($category->description) && strlen($category->description) > 1 && $GLOBALS[‘CORE_THEME’][‘category_descrition’] == 1){
    echo “<div class=’category_desc’>”.nl2br(do_shortcode($category->description)).”</div>”;

    // print out sub categories
    if($GLOBALS[‘CORE_THEME’][‘subcategories’] == ‘1’ && $canShowExtras && !isset($_GET[‘s’]) ){
    $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) );
    //JM if ($term->parent == 0) {
    $cats = wp_list_categories(‘echo=0&taxonomy=’.#8217;&depth=1&hide_count=0&hide_empty=0&title_li=&child_of=’ . $term->term_id);
    echo ‘<div id=”wlt_core_subcategories”>’.str_replace(“<li”,”<span”,str_replace(““,”</span>”,$cats)).'<div class=”clearfix”></div></div>’;
    //JM }

    I have just commented out the If statement.
    It does mean when you go to a category with no subcategories you now get the text No Categories – it’s not a big deal but I’ll probably look at getting rid of this but I’m waiting for the new version first.

  • Richard
    September 6, 2015 at 7:52 pm


    Only downside to modding your core code is that when an update comes out, you’ll lose all you changes.

    Make a backup 😉

  • Janak
    September 6, 2015 at 9:11 pm

    Yeah Richard, I know. That’s why I’m clarifying that I can put the modified function in a child theme!

  • Richard
    September 6, 2015 at 9:57 pm

    @ Januk,

    That’ll teach me to read the thread more carefully 😉

  • Mark
    September 7, 2015 at 12:27 pm

    You can’t override the but as the function gallerypage_results_before is only called in the file, you can do the following:

    1) Add the modified function to your child theme file and name it ‘gallerypage_results_before_new’ – or something similar
    2) Copy the file to your child theme
    3) Edit the in your child theme and replace the
    with your new function:


  • Janak
    September 8, 2015 at 11:01 am

    @Richard, no problem.

    @Mark, thanks for that, that’s definitely a better option than changing core file.
    One question – as you say I can’t override in child theme but can’t I override the function gallerypage_results_before by adding a modified copy with the same name to my child theme?

  • Hemanta Chakladar
    Hemanta Chakladar
    September 8, 2015 at 12:10 pm

    FYI doesn’t work from child theme. You have to edit and kkeep search file in parent theme.

  • Janak
    September 8, 2015 at 1:01 pm

    Thanks Hemanta. That’s not really a problem for me as I’m really wanting to override the function gallerypage_results_before() in a child theme. In your earlier post on here you said it could be done.

    Can I just put my modified function in the file in my child theme?

  • Hemanta Chakladar
    Hemanta Chakladar
    September 8, 2015 at 1:45 pm

    Yes, I thought it as a independent function, that can be override, but it isn’t. Now it is as simple as copy that code and put it on and should works on child-theme, so your modification remains in child theme, ideally.

    Here problem is should be on parent theme. So, you solution is edit that file and kept that file while updating. Its not a core theme file. Its just a theme tmplate, no problem in editing it.


  • Janak
    September 8, 2015 at 8:38 pm

    Ok, thanks for the info Hemanta.

Viewing 15 posts - 1 through 15 (of 16 total)