This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Search Results: Dropdown Width & Show Categories

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search Results: Dropdown Width & Show Categories Reply To: Search Results: Dropdown Width & Show Categories

#13319
Ernest MarcinkoErnest Marcinko
Keymaster

Hi!

1. I would not recommend making direct change to the plugin files, instead use this custom CSS code:

[html]div[id*=ajaxsearchprores] {
width: 850px !important;
}[/html]

2. To display all categories, you will need a custom filter. Based on this knowledge-base example, this code should do the trick:

[php]add_filter( ‘asp_results’, ‘asp_add_category_titles’, 1, 1 );

function asp_add_category_titles( $results ) {
foreach ($results as $k=>$v) {

// Get the post categories
$post_categories = wp_get_post_categories( $results[$k]->id );
$cats = array();

// Concatenate category names to the $cats variable
foreach($post_categories as $c){
$cat = get_category( $c );
$cats[] = $cat->name;
}

// Modify the post title
if ( count($cats) > 0 )
$results[$k]->content .= " ".implode(‘, ‘, $cats);
}

return $pageposts;
}[/php]

I have not tested this code, so please be careful!