Home › Forums › Calendar Products › Events Calendar PRO › Custom Templates – Single Event – Custom fields, move from bottom to top of page
- This topic has 13 replies, 5 voices, and was last updated 12 years, 2 months ago by
Leah.
-
AuthorPosts
-
January 19, 2014 at 9:35 pm #94617
thisisart
ParticipantI have a custom URL field called “TICKETS” – its for the event’s ticket link. I want to move it from the bottom of the page to the top of my “single events” page–AFTER event title/date/and ticket price. Wouldn’t that look nice? A ticket link at the top of the page, right after the ticket price!
I have successfully duplicated the “single-event.php” file in my themes folder under “[your-theme]/tribe-events/day/single-event.php” – but my intuition is telling me this isn’t the page I’m looking to edit. Can I get some confirmation on which PHP page is the right one to edit?
PS: This is the ONLY custom field I will have, so I have no problem moving the custom field PHP code to the top of the page.
Thanks,
Art
January 20, 2014 at 5:15 pm #94934Julie Kuehl
ParticipantHey Art,
I think you’ll find the information you need over at https://theeventscalendar.com/the-events-calendar-for-wordpress-tutorials/#single-events If you still have questions, just let me know.
— Julie
January 20, 2014 at 5:37 pm #94953thisisart
ParticipantI still have questions – I have done everything on the tutorial, now I need help finding the actual code and the place I would paste it into.
Many thanks for your assistance,
ArtJanuary 21, 2014 at 4:23 pm #95409Julie Kuehl
ParticipantArt,
If you copy the single-event.php over to a folder in your theme as indicated, you should be able to make your edits there.
* Single Event Template
* A single event. This displays the event title, description, meta, and
* optionally, the Google map for the event.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.phpDoes that make sense?
— Julie
January 21, 2014 at 4:47 pm #95428thisisart
ParticipantJulie- it does make sense, great explanation – which line # is the custom fields PHP located at in “single-events.php”? And additionally, which line # does the title/date/ticket price start?
Fortunately I understand the concept of this, so once you can give me the exact line #’s in the PHP I will be able to manage from here on out.
Thanks,
Art
January 22, 2014 at 4:42 pm #95773Julie Kuehl
ParticipantHello art,
Not sure exactly where you want it, but somewhere around line 50 might be a good place to start.
— Julie
January 22, 2014 at 4:58 pm #95793thisisart
ParticipantAre you certain this advice is accurate? The reason I ask is because I am pretty versed on editing PHP pages (this code looks nothing like the single event to me) and just out of scientific deduction, I deleted the “single-event.php” file from the plugin directory under “plugins/event-calendar-pro/views/pro/day/single-event.php” – It has no effect whatsoever on the page (keeping in mind I haven’t initiated a custom template on the back end, so this should effectively crash the page, right?), which leads me to believe that your tutorials are having me edit the wrong file.
Please advise- many thanks,
Art
January 22, 2014 at 5:21 pm #95805thisisart
ParticipantAllow me to clarify- I am NOT wanting to edit “day view single events”, I want to edit the *single event* page for *one* specific event.
IE: Single event URL / Your single event URL is: example.com/event/single-post-name/Where is the PHP page to edit single event pages for the Pro version? I’m currently editing the wrong PHP file as I suspected.
Thanks for your response,
Art
January 22, 2014 at 5:54 pm #95841thisisart
ParticipantI found the correct single-events.php file I was looking for in the plugin directory: [the-events-calendar/view/single-events.php]
I also found the place I want to place the custom fields code (line# 35)
Now I need to find the custom fields code – which PHP file contains the code for the display of custom fields on single events?
Many thanks for your help,
Art
January 23, 2014 at 11:10 pm #96374Brook
ParticipantHowdy Art,
You are spot on, that’s the file. We have so many single-event.php files it can get a bit confusing, at times even for one of us. Hence why the incorrect one was accidentally recommended.
On line 63, notice the call toΒ tribe_events_single_event_meta(). That’s what shows the entire box of meta info. If you want to selectively display meta info then replace that line with individual calls. If you look inside of the function linked above, you will see the HTML and functions it uses to output the meta box. Simple copy and paste it, then remove the bits you don’t want.
Now for adding your custom meta field elsewhere. That can be accomplished with the following code snippet
tribe_get_meta('tribe_event_custom_meta')
That will output the Custom field and its title in a dt/dd pair. You can insert it anywhere you want in your template.Is that all making sense? Are you now able to make the change? Please let me know if we can be of further assistance. Julie asked me to assist since custom themes are a bit more my area. Thanks!
– Brook
January 24, 2014 at 7:29 am #96431thisisart
ParticipantAwesome – since I’m going to be using the custom fields in a different location, I don’t want the information duplicated in the meta box. Is there any way I can remove it from the meta box?
I’m on the right track here thanks to all your help- cheers,
Art
January 24, 2014 at 8:54 am #96465Brook
ParticipantHowdy Art,
You are quite welcome. And yes, you definitely can. That is the bit you should remove from the code you copied out of tribe_events_single_event_meta(). As luck you would have it I have a snippet that does just this. You see on line 93 where the filter tribe_events_single_event_the_meta_addon is commented out? That’s how you remove it. This snippet is the entire single-events.php file. If you have made any customizations to your own, then you will have to either copy the bits of code from this file that you need, or copy this entire file and redo your changes.
Does that work and make sense? Please let me know!
– Brook
February 7, 2014 at 11:55 am #101982James
ParticipantThis article has been very helpful, but I don’t see that there’s a clear answer to Art’s very specific question: how do you display a single element from the meta box in a different part of the template?
So instead of moving the whole meta area around, you’re leaving 90% of it where it is but removing one element (the website link) elsewhere in the template.
Thank you!
February 11, 2014 at 10:40 am #103368Leah
MemberHi James,
Would you mind starting your own thread? That will help us focus on your situation and get you better and faster help π
Thanks!
Leah
-
AuthorPosts
- The topic ‘Custom Templates – Single Event – Custom fields, move from bottom to top of page’ is closed to new replies.
