[GUIDE]Show Sub Category in Category Page

This how to show sub categories of the clicked category page : 1- Download and install the php widget plugin from https://wordpress.org/plugins/php-code-widget/ or any other plugin that will let you excute php and activate it. 2-go to wordpress menu > appearance > widgets > drag the "php code" widget to the top of right column side bar . 3- insert the Following code : <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); if ($term->parent == 0) { wp_list_categories('taxonomy=listing&depth=1&hide_count=0 &hide_empty=0&title_li=&child_of=' . $term->term_id); } else { wp_list_categories('taxonomy=listing&hide_count=0 &hide_empty=0&title_li=&child_of=' . $term->parent); } ?> 4- The code now shows everywhere so let's prevent that by doing the following a. Select "Show widget if ALL active conditional tags return FALSE b. Drag and drop "in_home" and "in_singular" c. click the options icon of "in_singular" and click "listing_type" and click ok . the "in_home" will prevent it from showing in the homepage and "in_singular" will prevent it from showing in the actual listing when viewed. You can after that start playing with the styles as you wish . See screenshot Good Luck and do it at your own risk !

Created: September 12, 2013 at 5:16 am
  • In: Directory Theme
  • Started by: yosefyosef
  • 3 members left 3 comments
  • Last reply from: Mark FailMark Fail

  • yosef
    September 12, 2013 at 5:20 am

    Example can be seen here

  • Vivian
    September 12, 2013 at 5:35 am

    Hi, thanks this came through to the forum just as I started to pull my hair out over how to customise the categories search

  • Mark Fail
    Mark Fail
    September 12, 2013 at 6:43 am

    thanks for sharing 🙂

Viewing 4 posts - 1 through 4 (of 4 total)