Greg Winiarski on "[Plugin: WPAdverts - Classifieds Plugin] Search By Category"

ساخت وبلاگ

Hi,

I'm trying to implement the ability to search by category.

I created a plugin file as follows but it displays the search field as a scrollable list - is it possible to make this a drop downm multi-select list?

<?php /* Plugin Name: E4S Plugin URI: http://www.equity4sweat.com Description: Plugin for editing content of WPAdverts plugin Author: G Fenney Version: 1.0 Author URI: http://www.equity4sweat.com */
add_filter( 'adverts_form_load', 'search_by_category_form_load' );
/**
* Adds category dropdown into search form in [adverts_list].
*
* @param array $form Search form scheme
* @retu array Customized search form scheme
*/
function search_by_category_form_load( $form ) { if( $form['name'] != 'search' ) { retu $form; } $form['field'][] = array( "name" => "advert_category", "type" => "adverts_field_select", "order" => 20, "label" => __("Category", "adverts"), "max_choices" => 10, "options" => array(), "options_callback" => "adverts_taxonomies", "meta" => array( "search_group" => "visible", "search_type" => "full" ) ); retu $form; }
add_filter( 'adverts_list_query', 'search_by_category_query' ); /** * Adds tax_query param to WP_Query * * The tax_query is added only if it is in $_GET['advert_category'] * * @param array $args WP_Query args * @retu array Modified WP_Query args */ function search_by_category_query( $args ) { if( ! adverts_request( "advert_category" ) ) { retu $args; } $args["tax_query"] = array( array( 'taxonomy' => 'advert_category', 'field' => 'term_id', 'terms' => adverts_request( "advert_category" ), ), ); retu $args; }

Please help

https://wordpress.org/plugins/wpadverts/

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 282 تاريخ : چهارشنبه 26 خرداد 1395 ساعت: 17:09