/** * Fix active class in wp_list_pages for search results page. * * @param string $pages * @return string */ function ph_list_pages($pages) { if (is_propertyhive()) { // Remove current_page_parent class from any item. $pages = str_replace('current_page_parent', '', $pages); // Find search_results_page_id through Property Hive options. $search_results_page = 'page-item-' . ph_get_page_id('search_results'); if (is_search_results()) { // Add current_page_item class to search results page. $pages = str_replace($search_results_page, $search_results_page . ' current_page_item', $pages); } else { // Add current_page_parent class to search results page. $pages = str_replace($search_results_page, $search_results_page . ' current_page_parent', $pages); } } return $pages; }
/** * is_propertyhive - Returns true if on a page which uses PropertyHive templates * * @access public * @return bool */ function is_propertyhive() { return apply_filters('is_propertyhive', is_search_results() || is_property() ? true : false); }