Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1249754

    Hi, I’m using the Blog Posts element to display my Events Calendar events, because I need to be able to query in a custom taxonomy (the Upcoming Events element only lets me query by category). But the Blog Post element doesn’t show the event time in the blog meta — see bottom of http://12x.f4e.mwp.accessdomain.com/property/camino-del-mar — do you know how I might get those event times to show next to the date? Thanks and lmk if you have any questions.

    #1250757

    Hey sky19er,

    Thank you for the inquiry.

    The event time is not included in the blog post template by default, so it has to be added manually by editing the shortcode file or the post template. You could start by editing the includes > loop-index.php file around line 233 where the blog meta container starts.

    You may also need to use the following function to get the event date.

    // https://docs.theeventscalendar.com/reference/functions/tribe_get_start_date/

    Best regards,
    Ismael

    #1251046

    Hey, thanks, Ismael, but I’m afraid this might be over my head. I’m looking at that includes > loop-index.php, around 233, and wondering: how is the tribe event date (as opposed to the post publish date) being called there? You know what I mean? The tribe event date is showing in these posts (at the bottom of https://gobeyondhomes.org/property/camino-del-mar/ for example) — so is that tribe meta somehow being displayed via that blog meta output in line 235 of the loop index?

    Also, if I try to just copy/paste that function from the tribe site into either the loop index or my child theme functions file, I get a critical error. But it seems to me that event time should somehow already be available in Enfold, since it displays in that Upcoming Events element — know what I mean? Shouldn’t I be able to sort of repurpose the code that generates the tribe event date and time for the Upcoming Events element and use it in the Blog Element?

    Sorry, I know it’s probably my lack of proficiency in php that’s preventing me from understanding, but if you can offer any other clues, I sure would appreciate it.

    #1251670

    Hi,

    Thank you for the update.

    The event posts also have a published date which is what the blog template displays by default. The Blog Posts element is not really intended to display events but it can be modified if necessary.

    Please edit the includes > loop-index.php file and look for this code around line 377:

    echo "<time class='date-container minor-meta updated' >" . get_the_time( get_option( 'date_format' ) ) . '</time>';
    

    Replace it with:

    $time =  get_the_time( get_option( 'date_format' ) );
    
    					if(get_post_type(get_the_ID() == 'tribe_event')) {
    						$time = tribe_get_start_date(get_the_ID(), true);
    					} 
    
    					echo "<time class='date-container minor-meta updated' >" . $time . '</time>';
    

    This will display the event time instead of the published date if the post type is event.

    Best regards,
    Ismael

    #1251807

    Epic, man — you killed it — thank you!!! Now, is there any way for me to get that in my child theme?

    #1251983

    Hi,

    You can place the edited file within the child theme structure.

    Best regards,
    Jordan Shannon

    #1251997

    Oh, thanks, sorry — I had tried that, but it seemed like it wasn’t working — but I just tried again and it does seem to be working now, so I guess I just did something wrong the first time. OK, great, thanks!!! Feel free to close this thread.

    #1252160

    Hi,

    Alright. Glad it works. Please feel free to open a new thread if you need anything else.

    Have a nice day.

    Best regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘show event time in blog meta’ is closed to new replies.