Date format question

Home Forums Calendar Products Events Calendar PRO Date format question

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #737467
    Alex Vasquez
    Participant

    Hi there,
    I need to customize a template so that the Display calendar shows a parituclar format. See screenshot: https://www.evernote.com/shard/s2/sh/8995bc4f-39c3-4d41-8a72-695642343df1/0cfbe3a736a1f73b45d195dfd441dea9 – The text in black is how it is now. The text in red is what I want it to more or less be.

    Thanks so much.

    #737983
    Geoff
    Member

    Hi and welcome back to the forum!

    You can customize styles directly in your theme’s CSS file.

    Try adding this to your CSS:

    .single-tribe_events .tribe-events-schedule h3 {
      color: #ff2e6c /* or whatever color you want */
    }

    If you need help with more customizations, I’d recommend checking out our Themer’s Guide. There’s a lot of excellent stuff including customized styles.

    Does this help? Please let me know.

    Cheers!
    Geoff

    #738093
    Alex Vasquez
    Participant

    Hey Geoff,
    Thanks for a speedy reply. =)
    What I meant was the actual Date Format, not the CSS colors. For all Events I want to show Just the Full Month Name, Start Date (Day only), End Date (day only) and the 4 digit year.

    #738229
    Geoff
    Member

    Ah, thanks for clarifying! 🙂

    The date format can be changed by creating an override of the /public/template-tags/general.php file. Follow the steps for creating custom template files if you’re unfamiliar with creating an override.

    Change line 875 of general.php to this:

    $schedule .= tribe_get_start_date( $event, false, $date_without_year_format ) . ( $time ? $datetime_separator . tribe_get_start_date( $event, false, $time_format ) : '' );
    

    Does that make sense? Will that work for you? Please let me know. Cheers!

    Geoff

    #740117
    Alex Vasquez
    Participant

    Hey Geoff,
    I think I still need some help here. THanks for the help so far. I’m familiar with THeme Customization of those items within the Trive-Events folder, inside of a theme. Not sure how to go about modifying the file you note. THe documentation didn’t seem to help on that front.

    Where would I copy general.php to?

    #740568
    Geoff
    Member

    This this is what your files structure will look like:

    /wp-content/[your-theme]/tribe-events/public/template-tags/general.php

    Copy the general.php file that is in the plugin files and paste it in the theme override folder. From there, you can edit Line 875 with the code:

    $schedule .= tribe_get_start_date( $event, false, $date_without_year_format ) . ( $time ? $datetime_separator . tribe_get_start_date( $event, false, $time_format ) : '' );

    Let me know if that works. 🙂

    Geoff

    #740630
    Alex Vasquez
    Participant

    Okay. I went ahead and did this just fine. I changed the lilne of code you mention and that didn’t seem to make a difference: https://www.dropbox.com/s/pe8kfkguu3zydcx/Screenshot%202014-09-12%2014.51.23.png?dl=0

    I removed my previous formatting as well, so this is the unmodified version of the single-events.php template file in my theme folder along with the general.php file.

    #740809
    Geoff
    Member

    Sorry, I totally led you the wrong way on this one. While general.php is the correct place to change the date format, it is actually not possible to replace it with a theme override. I really apologize for steering you the wrong way there.

    What you’ll need to do is write a custom function using the tribe_events_event_schedule_details() filter and add that to your theme’s functions.php file. I’ve double-checked this directly with my team this time and this is the way to go. Here’s a direct link to the documentation. 🙂

    You can still edit the general.php file if you’d like, but that customization would be lost the next time the plugin is updated.

    Sorry again for the misinformation, but I hope this better answers your question!

    Cheers,
    Geoff

    #745014
    Geoff
    Member

    Here is a snippet you can try in your functions.php file.

    #745135
    Alex Vasquez
    Participant

    Awesome. Does the trick nicely, Geoff. Thank you.

    Lastly, to change the date format of the sidebar widgets and the Archive Events Page, is that more or less change the template files by overriding those, too?

    #745171
    Geoff
    Member

    Awesome, glad that worked!

    Yes, changing the format in the sidebar widgets would require a similar solution. The widget templates are located in the /views directory, so they can be customized with a theme override, but they also pass the same tribe_events_event_schedule_details(); function.

    I’m going to go ahead and close this thread since it seems like we nailed down the original question, but please feel free to start a new thread if any other questions pop up. 🙂

    Cheers!
    Geoff

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Date format question’ is closed to new replies.