• Resolved rajs1010

    (@rajs1010)


    Hi Greg,WPadverts is awesome plugin.
    i have one problem,
    whenever i select the main adverts-category,its shows all adverts of that category including sub categories list. but it needs to show sub-category name above the lists. example :–
    i have attached srceen shot .in that ‘properties’ is main category and ‘for sale’,’for rent’ & ‘new projects’ are the sub categories of that main category. so that sub-category adverts can be filter easily..
    THanks in advance.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    so basically you would like to show above the [adverts_list] a list of sub-categories for a currently selected category?

    If so then you can do that 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';
      }
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Sub category dispaly’ is closed to new replies.