Home › Forums › Calendar Products › Events Calendar PRO › Whole Search Bar on another page.
- This topic has 17 replies, 4 voices, and was last updated 9 years, 5 months ago by Geoff.
-
AuthorPosts
-
October 27, 2014 at 1:55 am #839962calumjamesgreenParticipant
Hi creating a new ticket as I posted this off the back of someone else but I am looking for the entire search bar that is used in the events pro to be able to be used on another page. Basically I want the bar to be put on my home page and then from there users could use it , hit search and they will be taken to the same place as if it was being used on the calendar page.
Thanks for any help.
————————Iβll go ahead and close this ticket. When opening another ticket, itβll be helpful to clarify exactly what you would like to display on your homepage. For example, are you wanting this entire bar to display on your homepage or was it something simpler you were looking for?
October 27, 2014 at 2:34 am #840023jordan0286ParticipantHi, i’m looking for exactly the same thing.
TY for helpOctober 27, 2014 at 9:45 am #841020GeoffMemberHi there, Calum! Nice to see you again and hope all is well. π
That’s an interesting question! The search bar is broken into its own module (/the-events-calendar/views/modules/bar.php), so you could grab the code from there, or PHP include it in the theme file(s) where you want it to be used.
That will pull the code in, but will leave out the other scripts and styles needed for it to display and function properly. You can overcome this by enqueuing those scripts in your functions.php file.
Here’s what that might look like:
https://gist.github.com/geoffgraham/510e158ae56a77ed9e76Of course, you may need to customize this to suit your specific needs and theme, and also you likely will not need the opening and closing PHP tags. Though this is the sort of customization we’ll leave in your hands, it should point you in the right direction.
Does that make sense? Will that work for you? Please let me know. π
Cheers!
GeoffOctober 27, 2014 at 11:09 am #841279calumjamesgreenParticipantHi Geoff,
Thanks for getting back to me that is really helpful, I was already using the script inside the bar.php but the code kept throwing an error when using the [insert_php] plugin. I have added your script that you have sent through and tried it in both the functions.php and using the [insert_php] plugin however it keep throwing an error
in the script I get this error:
Fatal error: Call to undefined function add_action() in /wp-includes/functions.php on line 4665and in the plugin
Fatal error: Cannot redeclare tribehome_enqueue_front_page_scripts() (previously declared in /wp-content/plugins/insert-php/insert_php.php(48) : eval()’d code:4) in /wp-content/plugins/insert-php/insert_php.php(48) : eval()’d code on line 32
Any Idea’s
Thanks π Calum
October 27, 2014 at 4:33 pm #842049GeoffMemberHi there, Calum! Thanks for following up.
Honestly, I unfamiliar with the Insert PHP plugin, but I would suggest adding the bar.php code and snippet to your files manually. I have a feeling that the plugin may not be inserting the code properly.
Are you able to give that a shot? Please let me know.
Cheers!
GeoffOctober 27, 2014 at 4:49 pm #842090jordan0286ParticipantHi everyone.
Doesn’t works even if i paste the php code into a php file (like search template) and add the code in functions.php
When I paste the code into the search template I get some search inputs but useless and without design.
When I paste the code into the functions.php I get a blank page.To resume, we’d like to add the search bar on antoher page than the calendar one (on a header of a homepage for exemple), and when we’ll search on it, it will bring us to the calendar page with the good search results.
Best regards
October 28, 2014 at 3:58 pm #845049calumjamesgreenParticipantHi Geoff,
As with Jordan I am having no luck with this. :/ Really bugging me now I know my php isn’t top notch but theoretically it should be simple haha. π
Any more input π
Thanks for all your help
CalumOctober 28, 2014 at 4:11 pm #845075jordan0286ParticipantCalum I trie something but it doesn’t works very well.
Here is what I did :In my theme, I have a template page called Search Page that make appears a search box. In appearance then editor I search the Search Page template (page-search.php), and I remplace the original input type with this one :
<input type=”hidden” value=”tribe_events” name=”post_type” id=”post_type” />
Just the value is modified here.
Now I have a search box in the search page that goes to the calendar page when I search something. It works but it only search on the current month (for exemple if I had an event in november, it says “sorry, try the same search word in another month”, think like that). Also, it doesn’t takes the tags in the search results. Not really what I wanted… I would like the same bar search as in calendar page.
Maybe someone who passes here will be able to help us. The problem seems simple, but it doesn’t work.
Sorry for my english langage, I’m french.
October 29, 2014 at 8:03 am #846748GeoffMemberHey there, Calum! Thanks for following up. π
A similar approach to the one I shared is detailed a little more thoroughly in this post:
http://gregorypearcey.com/blog/add-tribe-events-search-bar-home-page/It focuses on placing the bar only on the homepage, but it gives you an idea of how it could work on any other page as well.
—
jordan0296, it looks like the original approach I outlined was actually working for you as well, but you may not have correctly added the snippet to your functions.php file. Note that you may need to remove the opening and closing PHP brackets in the snippet when you place it in there. A blank screen implies a PHP formatting issue rather than the snippet not working. π
It’s that snippet that will add the design elements you said were missing.
—
I’m going to continuing answer Calum’s questions in this thread since she originally opened it. Anyone else is certainly welcome to follow along but, if you are experiencing your own issue, I suggest opening up a new thread so we can concentrate on one question at a time. π
Cheers!
GeoffOctober 29, 2014 at 8:59 am #846908calumjamesgreenParticipantThanks for getting back Geoff, I appreciate this is probably outside of support that is meant to be offered and I appreciate it.
I have it almost working using the [insert_php] but the formatting is still fuzzy so I have tried creating a page template to be applied to the home page and have this error. Am I missing something clear?
[Error] ReferenceError: Can’t find variable: tribe_ev
global code (tribe-events-bar.js, line 334)Thanks Again
October 29, 2014 at 9:08 am #846927GeoffMemberNo worries, Calum! I’m happy to answer your questions and will always do my best to point you in the right direction. π
Are you able to follow the steps in the link I sent over without relying on the [insert_php] plugin? I think that’s becoming a stumbling point to getting this to work properly. I realize it requires touching some code and templates that might be a little outside your comfort zone, but the effort will pay off for sure. Otherwise, it may be something worth reaching out to a developer for.
Cheers!
GeoffOctober 29, 2014 at 9:12 am #846941calumjamesgreenParticipantYeah I have created a plugin for
function tribehome_enqueue_front_page_scripts()
and activated it.I have then created a new page template and added the script for
<div id=”tribe-events-bar”>I think it might be this part I am missing Next I had to enqueue the styles for the search bar as well as the scripts for the date picker as is suggested on the Tribe Forum.?
October 29, 2014 at 9:36 am #846983GeoffMemberYeah, the plugin you created is what should be enqueuing those styles for you. Alternatively, you can disable that plugin and paste this snippet into your functions.php file instead. It also enqueues those styles.
The thing to note about the snippet is that it specifically targets the homepage. You will want to modify the snippet to target your specific template or pages.
I hope this helps!
Geoff
October 29, 2014 at 9:39 am #846994calumjamesgreenParticipantYeah I think that the theme I’m using might be playing with the homepage so although it is targeting the homepage its not recognising it as the homepage, I will see if I can amend it to target that specific page template and see if I have any luck.
Ill let you know π
October 29, 2014 at 3:12 pm #847655GeoffMemberAwesome, please keep me posted. π
-
AuthorPosts
- The topic ‘Whole Search Bar on another page.’ is closed to new replies.