Custom Templates – Single Event – Custom fields, move from bottom to top of page

Home Forums Calendar Products Events Calendar PRO Custom Templates – Single Event – Custom fields, move from bottom to top of page

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #94617
    thisisart
    Participant

    I 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

    #94934
    Julie Kuehl
    Participant

    Hey 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

    #94953
    thisisart
    Participant

    I 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,
    Art

    #95409
    Julie Kuehl
    Participant

    Art,

    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.php

    Does that make sense?

    — Julie

    #95428
    thisisart
    Participant

    Julie- 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

    #95773
    Julie Kuehl
    Participant

    Hello art,

    Not sure exactly where you want it, but somewhere around line 50 might be a good place to start.

    — Julie

    #95793
    thisisart
    Participant

    Are 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

    #95805
    thisisart
    Participant

    Allow 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

    #95841
    thisisart
    Participant

    I 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

    #96374
    Brook
    Participant

    Howdy 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

    #96431
    thisisart
    Participant

    Awesome – 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

    #96465
    Brook
    Participant

    Howdy 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

    #101982
    James
    Participant

    This 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!

    #103368
    Leah
    Member

    Hi 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

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Custom Templates – Single Event – Custom fields, move from bottom to top of page’ is closed to new replies.