
BuddyPress Profile Search Extensions
- August 13, 2015
- Leave a comment
In order to elevate the scope of specific aspects of your business website, it is advised to bring into play the most technically modern online features. Profile search is a search feature that can be made refreshingly intriguing with the addition of options like location based research. It will certainly ease the users in finding their specified queries and your business will reap the benefits in the longer term.
We customized BuddyPress Profile Search to extend the search options as per requirement of our client. The extension adds ajax based profile fields enabling site customers to search profiles. It also allows customers to find users near specific location using Google Geocode API. There was no documented hook available to extend the search however we extended profile search using core hook. We gave a template path to BuddyPress Profile Display Shortcode and used bp_get_template_stack to override the existing template. This hook runs a function that adds our customized template to BuddyPress template stack to include the functionality of finding customer with Geocode API. We also enqueued stylesheet for the template using standard BuddyPress stylesheet hook bpes_enqueue_styles.
Below is the code snippet:
1 2 3 4 5 6 7 8 9 10 11 12 |
function bpes_template_include($stack){ $stack[] = untrailingslashit(WP_PLUGIN_DIR . '/bps-extended-profile-search/templates'); return $stack; } add_filter('bp_get_template_stack', 'bpes_template_include'); function bpes_enqueue_styles(){ wp_enqueue_script('jquery'); wp_enqueue_style('beps-ep-style', plugins_url('/css/beps-ep-style.css' , __FILE__ )); wp_enqueue_script('beps-ep-script', plugins_url( '/js/beps-ep-script.js' , __FILE__ ), '', '', true ); } add_action( 'wp_enqueue_scripts', 'bpes_enqueue_styles'); |
User Comments