Forums › Forums › Search & Filter Pro › Category Description
- This topic has 17 replies, 2 voices, and was last updated 7 years, 4 months ago by Anonymous.
-
Trevor(Private) July 21, 2017 at 7:15 am #121871
You would need to use some custom PHP code, which would have to be inside the results.php file you are using (see the customisation guide here). You should be able to find the appropriate code from either the WordPress Codex OR StackExchange.
To find the Category ID, you would also need some custom PHP, but this post/thread might help (with a few changes):
Anonymous(Private) July 23, 2017 at 11:34 pm #122324Okay I’ve worked out how to obtain the ID and get the description but the ID has an extra 1 at the end of the string which I’ve had to strip off.
Can you see why it would have the extra one and how to avoid it?
Thanks
<?php global $searchandfilter; $sf_current_query = $searchandfilter->get(119)->current_query()->get_array(); $currentCat = $sf_current_query['_sft_project_category']['active_terms'][0]['id']; $currentCatID = rtrim($currentCat,'1'); echo category_description( $currentCatID ); ?>
Anonymous(Private) July 24, 2017 at 9:04 am #122357I get the following (you can see a 1 at the end of the array):
Array ( [_sft_project_category] => Array ( [name] => Product Categories [singular_name] => Product Category [all_items_label] => All Categories [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 6 [name] => Fruit [value] => fruit [count] => 7 ) ) ) [_sft_project_tag] => Array ( [name] => Product Tags [singular_name] => Product Tag [all_items_label] => All Tags [type] => taxonomy [active_terms] => Array ( [0] => Array ( [id] => 8 [name] => 6+ Months [value] => 6-months [count] => 11 ) ) ) ) 1
-
AuthorPosts