• Hi – I am hoping your plugin will work or us. We purchased the BP integration and Mark as Sold too. We want to create a Craigslist-type listings page that is very light on bandwidth. We like your “Lite” demo and we found a theme that lets us add the Categories widget to the main page (and not the sidebar).

    Questions:
    1. How do we remove the icons and have text links just to the categories and subcategories?
    2. How do we display all categories and subcategories even if they are empty?
    3. Is it possible to swap the search by location field to search by category? (Our site is just for a single location). Or remove the location field altogether?

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter willowcreekcommunity

    (@willowcreekcommunity)

    Apologies for the false alarm. We did manage to find the answers to #1 and #2. Still hoping to get an answer for #3. Oh, and

    4. Is there any possibility of putting an excerpt of the description in the ad box when you choose “Display Ads As = List”? Maybe instead of the date?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    3. you can add the code below in your theme functions.php file, it will replace the location field with categories dropdown

    
    add_filter( 'adverts_form_load', 'search_by_category_form_load_2' );
    add_filter( 'adverts_list_query', 'search_by_category_query_2' );
    function search_by_category_form_load_2( $form ) {
        if( $form['name'] != 'search' ) {
            return $form;
        }
        foreach( $form["field"] as $key => $field ) {
            if( $field["name"] == "location" ) {
                unset( $form["field"][$key] );
            }
        }
    
        $form['field'][] = array(
            "name" => "advert_category",
            "type" => "adverts_field_select",
            "order" => 20,
            "label" => "",
            "max_choices" => 10,
            "options" => array(),
            "options_callback" => "adverts_taxonomies",
            "meta" => array(
                "search_group" => "visible",
                "search_type" => "half"
            )
        );
        return $form;
    }
    
    function search_by_category_query_2( $args ) {
    
        if( ! adverts_request( "advert_category" ) ) {
            return $args;
        }
    
        $args["tax_query"] = array(
            array(
                'taxonomy' => 'advert_category',
                'field'    => 'term_id',
                'terms'    => adverts_request( "advert_category" ),
            ),
        );
    
        return $args;
    }
    

    4. in order to add the excerpt to the [adverts_list] you would need to open file wpadverts/templates/list-item.php and add the additional code there.

    Note that if you decide to customize the list-item.php file it is best to create a child template for it so your changes will not be overwritten on WPAdverts update.

    The child template you can create as explained here https://wpadverts.com/documentation/child-themes-and-templates/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Lite version that displays empty sub/categories’ is closed to new replies.