Support » Plugin: WPAdverts - Classifieds Plugin » Search By Category Not Working

Viewing 10 replies - 1 through 10 (of 10 total)
  • I tested it on WordPress version 4.4.2 also . Its not working even on compatible version. Please help.

    Plugin Author Greg Winiarski

    (@gwin)

    What do you mean by “not working”, the category input does not display on [adverts_list]? the input shows but does not filter? or filtering shows an error page?

    The category input displays on [adverts_list] but whenever i search any category it does not return any result. Am i missing something? What are the conditions under which the classified ads according to category text are displayed?

    Plugin Author Greg Winiarski

    (@gwin)

    The search by category snippet https://github.com/simpliko/wpadverts-snippets/blob/master/search-by-category/search-by-category.php has everything you need to search by category, if you have whole code copied it should work fine.

    The conditions / search params are applied to search in search_by_category_query() function.

    Hi Greg – apologies I replied on the incorrect post but I am having this same issue. I will note however that I have narrowed this down to a plugin is causing this issue.

    `add_filter(“adverts_form_load”, “change_query_param_name”);
    add_filter(“adverts_list_query”, “change_query_search”);
    function change_query_param_name( $form ) {
    if( $form[“name”] != ‘search’ ) {
    return $form;
    }

    foreach( $form[“field”] as $i => $field ) {
    if($form[“field”][$i][“name”] == “query”) {
    $form[“field”][$i][“name”] = “advert-query”;
    }
    }

    return $form;
    }
    function change_query_search( $args ) {
    if( adverts_request( “advert-query” ) ) {
    $args[“s”] = adverts_request( “advert-query” );
    }

    return $args;
    }

    I tried the above code as well as adding the plugin as per above but neither solutions work.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi, can you paste a link to website where you have the search form so I could take a look at it on site?

    http://feathersandscales.peaksmedia.com/adverts/

    This is just a test site (the Adverts part anyway) hence the odd ads 😉

    It’s the categories section that is not working. Please let me know if you would like an admin un/pw and I will PM you as I’d prefer this site not be be available to the public.

    Thank you for you time to look into this.

    Cathy

    Plugin Author Greg Winiarski

    (@gwin)

    Hi, please try changing the search_by_category_query() function to the one below and see if it helps

    
    function search_by_category_query( $args ) {
        
        if( ! adverts_request( "advert_category" ) ) {
            return $args;
        }
        if( is_taxonomy( "advert_category" ) ) {
            return $args;
        }
        $args["tax_query"] = array(
            array(
                'taxonomy' => 'advert_category',
                'field'    => 'term_id',
                'terms'    => adverts_request( "advert_category" ),
            ),
        );
        
        return $args;
    }
    

    Apologies for the late reply.

    I replaced the code in the search by category plugin … no change made. Still get the same error “No categories found”

    • This reply was modified 2 years, 10 months ago by peaksmedia. Reason: update
    Plugin Author Greg Winiarski

    (@gwin)

    I am not sure than how to help you get that fixed, if you have some other plugins installed try disabling them and see if this helps, if not then try to change the theme.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Search By Category Not Working’ is closed to new replies.