Display days with 3 letters in mini calendar shortcode

Home Forums Calendar Products Events Calendar PRO Display days with 3 letters in mini calendar shortcode

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1185892
    Fadi
    Participant

    Hi
    I use the Event Calendar pro with shortcode [tribe_mini_calendar category=””]
    and I want to display the days with 3 letters not 1 letter

    For Monday: MON isntead of M

    #1186195
    Geoff B.
    Member

    Good evening Fadi and welcome to the Events Calendar Support forum!

    Thank you for reaching out to us.
    I would love to help you with this topic.

    The correct way to do this is through some template customization.
    You might want to read our Themer’s guide to get a sense of how that works.

    I suggest reading my colleague Josh’s suggestion for more details: https://theeventscalendar.com/support/forums/topic/mini-calendar-week-days-to-one-letter-abbriviation/#post-903103

    Let me know how that goes.

    Best regards,
    Geoff B.

    #1190489
    Fadi
    Participant

    Thanks for the link but it shows the opposite of what I am searching for.

    I have already the days in 1 letter (M, T, W, T, F, S, S). I am searching to display 3 letters in English (MON, TUE, WED, THU, FRI, SAT, SUN) in order to translate them with wpml to french (LUN, MAR, MER, JEU, VEN, SAM, DIM).

    I have tried the following code but I have a problem with tuesday/thirsday and saturday/sunday:

    <?php foreach ( $days_of_week as $day ) :
    if ( $day == ‘M’ ) {
    $day = ‘MON’;
    } elseif ( $day == ‘T’ ) {
    $day = ‘TUE’;
    } elseif ( $day == ‘W’ ) {
    $day = ‘WED’;
    } elseif ( $day == ‘T’ ) {
    $day = ‘THU’;
    } elseif ( $day == ‘F’ ) {
    $day = ‘FRI’;
    } elseif ( $day == ‘S’ ) {
    $day = ‘SAT’;
    } elseif ( $day == ‘S’ ) {
    $day = ‘SUN’;
    }?>
    <th class=”tribe-mini-calendar-dayofweek”><?php echo $day ?></th>
    <?php endforeach; ?>

    #1190732
    Geoff B.
    Member

    Good evening Fadi,

    Thank you for writing back.

    I see what you mean. The issue with your code is that simply using a value such as ‘T’ or ‘S’ will not work for your conditionals because many days share that same value.

    For your purpose, you are missing a step to either get specific values based on position in the array or some kind of bypass/customization of that array.

    Just to set expectations, as you might know, the scope of our support is mostly to get our customers started on the right track and to help them in case of issues.

    We unfortunately do not provide complete support for customization.

    If you are stuck, you might want to hire one of our recommended customizers to do the customization for you.

    I wish I had a better answer for you, but for now it’s the best one I have.

    Best regards,

    Geoff B.

    #1190741
    Fadi
    Participant

    I am not asking for cutomization. It is a simple display thing that the shortcode had to do. I have seen already on your pages such things
    https://theeventscalendar.com/content/uploads/2015/04/kb-widgets-calendar.gif

    If the plugin is unable to show days written instead of abreviation or simple letters, it is useless

    #1191235
    Geoff B.
    Member

    Good evening Fadi,

    I believe I have miscommunicated what I meant. My apologies.

    I am 100% convinced you can achieve what you are looking for. No question there.
    What I am saying is that “out of the box” you need some level of customization to achieve your specific goal.

    In fact, your code snippet is a great start. But, I do believe you have to review how it was written for it to work as expected (because of the identical names of the values found in the array you are working with).

    Tell you what, I will run this by our snippet wizards to see what they come up with.
    I can’t guarantee anything, but I have a pretty good feeling about this one.

    Have a good week-end,

    Geoff B.

    #1191783
    Geoff B.
    Member

    Good morning Fadi,

    I believe I have great news for you.

    I spoke to our code wizards. The best approach to this is doing a template override (as can be seen in our our Themer’s guide).

    Basically, you make a copy of the mini-calendar widget view file in your theme using the recommended path.

    Once that is done, replace line 16 in the template with this $days_of_week = tribe_events_get_days_of_week( 'short' ); . Replacing min with short will get you the results you are looking for.

    Let me know how that goes.

    Best regards,
    Geoff B.

    #1191809
    Fadi
    Participant

    That’s it
    Thanks

    #1192628
    Geoff B.
    Member

    Hey Fadi,

    I am super stoked that this worked out for you!

    You are welcome back in our support forums any time 🙂

    For now, I am going to close this thread.

    Have a great week!

    Geoff B.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Display days with 3 letters in mini calendar shortcode’ is closed to new replies.