rep__get_ralated_search_categories( $keyword, $search_categories )
This function is used to get a list of related search categories based on a given keyword (listing state or category) and a set of search
Namespace
REP_Malcolm
Parameters
$keyword
array
Listing state or category to get related search categories from the given search categories.
$search_categories
string
Search categories
Return
array
List of listing states/categories extracted
Source
File: \includes\rep-helper-functions.php
function rep__get_related_search_categories( $keyword, $search_categories ){
$list = [];
$keyword = strtolower( $keyword );
$search_categories = array_map( function( $value ){
return strtolower( $value );
}, $search_categories );
foreach( $search_categories as $search_category ) {
if( in_array( $keyword, explode( " ", $search_category ) ) ){
$list[] = $search_category;
}
}
return $list;
}