BuddyBoss Home – Web › Support Forums › Themes › Boss. theme › BuddyPress Global Search Plugin Templating
Tagged: search, searchfield, searchform
- This topic has 11 replies, 5 contibutors, and was last updated 8 years, 6 months ago by Varun Dubey.
Question
June 5, 2015 at 2:50 pm #40982@jreeveHi, apologies if this is the wrong forum, but I can’t seem to find the support forum for the plugin BuddyPress Global Search.
BuddyPress Global Search isn’t properly loading the header and footer templates of my theme. On the search results page, it returns only the raw search results, and is missing all the other template parts like headers, footers, and so on (including, therefore, CSS and JS).
What’s strange is that my search results page (template search.php) works fine without BuddyPress Global Search, and BuddyPress Global Search works fine with other themes.
What I’d like to know is: how does BuddyPress Global Search hook into the search.php template? How does it load or override the templates that are already there? How can I get it to load my template and other template parts properly?
Thanks very much for any information you can provide! I haven’t had too much luck in the WP plugin forums.
Answers
June 6, 2015 at 10:18 am #41026@alyssa-buddyboss
AlyssaParticipant@jreeve we don’t have a dedicated forum for these products, I’ll answer them in any forum you post them to 🙂
That is some interesting functionality. It would seem your theme might not be using proper WP standards. What theme are you using?June 6, 2015 at 10:21 am #41027@alyssa-buddyboss
AlyssaParticipantI believe we are simply editing the content of the default BP search content, so the header and foot should be loaded by the default search template.
June 8, 2015 at 7:01 am #41077@jreeveMy theme definitely doesn’t use proper WP standards yet, since I’m writing it from scratch, based on the Sage starter theme. Since Sage has a template wrapper, it hijacks the templates early to rewrite them in a DRY fashion. Could that be interfering with the way BuddyPress Global Search injects content into the BP search template? Is the BuddyPress default search template
search.php
? I’ve tried dropping in a number of othersearch.php
s, like the one from TwentyFifteen, and I still get a bare, headerless and footerless Search Results page no matter what. Is there a way I can filter the way BuddyPress Global Search injects content to the WP search results page, so that it is scoped in such a way as to not interfere with my theme’s handling of headers and footers?October 14, 2015 at 7:45 pm #48731@optimystichi there- I need my buddypress global search to take on our right-sidebar template and not the default template.
How can I accomplish this?Using BuddyBoss 4.2.1. with child theme
thanks,
kim, webmaster for http://thinkwithyourheart.comOctober 15, 2015 at 2:26 am #48742@
AnonymousHi @optimystic, to add the search box in your sidebar please add this function in your child theme’s function.php.
function bp_ser_shortcode( $args, $content, $tag ) { global $post; if (!is_singular()) { return '[Search form]'; } ob_start(); get_search_form(true); $ret = ob_get_contents(); ob_end_clean(); return "<p>$ret</p>"; } add_shortcode( 'search', 'bp_ser_shortcode' );
And then use this shortcode
[search]
wherever you want to display the search form.Regards
PallaviOctober 15, 2015 at 8:51 am #48775@optimysticI don’t need a search box in my sidebar, I need to edit the template that the search page uses. THe search feature, by default uses our default template. I need it to use the template “right sidebar”
Please advise.
October 15, 2015 at 1:12 pm #48787@
AnonymousHi @optimystic, Please copy the search.php from your main theme to your child theme and then you can apply your edits in search page.
By default, it shows Default Page Sidebar.
Regards
PallaviOctober 16, 2015 at 4:13 pm #48880@optimysticMy developer has attempted to do this, and the plugin templates cannot be overloaded.
It’s using these templates:
/wp-content/plugins/buddypress-global-search/templates/They are supposed to be over-loadable to child theme, but testing did not work.
@michael how can we add a sidebar to your search plugin template?October 17, 2015 at 2:17 am #48890@vapvarunHi @optimystic
You can move following for Boss theme to child theme with same structure
buddypress-global-search/results-page-content.php
RegardsOctober 17, 2015 at 4:29 pm #48995@optimysticThank you @vapvarun, unfortunately this doesn’t work.
I can see the file where you say it should go.
But still the template being used comes from the plugin.And this doesn’t address the issue of how to add a sidebar.
I already tried it directly in the plugin template files.No go.Please advise
October 18, 2015 at 12:52 am #48998@vapvarunHi @optimystic
You can include following codes inside the page.php
we are generating search results on dummy page which is generated run time without any page id
thus it is loading on default page.php template file
you can copy page.php inside the child theme and add the conditional login for the searchyou can call your own registered sidebar inside the is_search condition
<?php if ( is_active_sidebar('sidebar') ) : if(is_search()) { get_sidebar( 'search' ); } else { get_sidebar('sidebar'); } endif; ?>
for any content specific customization you can use buddypress-global-search/results-page-content.php
Regards
Varun Dubey
- The question ‘BuddyPress Global Search Plugin Templating’ is closed to new replies.