• Resolved chauthong

    (@chauthong)


    Hello, Thanks for this plugin!

    Is there any way to display subcategories on top of the categories page? (eg Laptop, Phone, Camera … these tabs will appear on the “Electronics” categories page). I am currently using Categories Widgets to do this. But on the layout for the phone, this part is pushed down, and not easy to manipulate for new users.

    Sorry for my English
    Thank you very much !

    • This topic was modified 5 years, 11 months ago by chauthong.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    you can display a list of subcategories above the Ads search bar (or ads list if you have search bar disabled) by adding the code below in your theme functions.php file

    
    add_action( "adverts_sh_list_before", "categories_above_adverts_list" );
    function categories_above_adverts_list( $args ) {
      global $wp_query;
      if( is_tax( 'advert_category' ) ) {
        $current_category = $wp_query->get_queried_object_id();
        // code for getting the sub categories and displaying them here
        $columns = "adverts-flexbox-columns-4";
        $show_count = 1;
        $terms = get_terms( 'advert_category', array( 
            'hide_empty' => 0, 
            'parent' => $current_category ,
            'number' => 0
        ) );
        include ADVERTS_PATH . '/templates/categories-top.php';
      }
    }
    
    Thread Starter chauthong

    (@chauthong)

    Hello,

    Thanks for your help, have a good day !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Subcategories on Page’ is closed to new replies.