an
groups-icon

[GUIDE]Show Sub Category in Category Page

Wait a minute... This content is very very old. We no longer sell or support this theme version. New Topics
  • Version 9
    Yosef jebara
    0 points
    Beginner

    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 !

    Attachments:
    You must be logged in to view attached files.
    September 12, 2013 at 5:16 am
  • Yosef jebara
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    September 12, 2013 at 5:20 am
  • Viv Rocka
    1 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    September 12, 2013 at 5:35 am
  • Mark Fail
    11,848 points
    Platinum User
    Bronze User Silver User Gold User Platinum User Helpful Award Fast Responder Thank You Coffee Villian Award Video Testimonial
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    September 12, 2013 at 6:43 am

337

Views

3

Replies