Home › Forums › Calendar Products › Events Calendar PRO › Display days with 3 letters in mini calendar shortcode
- This topic has 9 replies, 3 voices, and was last updated 9 years, 5 months ago by
Fadi.
-
AuthorPosts
-
November 1, 2016 at 9:52 am #1185892
Fadi
ParticipantHi
I use the Event Calendar pro with shortcode [tribe_mini_calendar category=””]
and I want to display the days with 3 letters not 1 letterFor Monday: MON isntead of M
November 1, 2016 at 11:05 pm #1186195Geoff B.
MemberGood 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.November 10, 2016 at 10:42 am #1190489Fadi
ParticipantThanks 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; ?>November 10, 2016 at 10:09 pm #1190732Geoff B.
MemberGood 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.
November 10, 2016 at 11:19 pm #1190741Fadi
ParticipantI 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.gifIf the plugin is unable to show days written instead of abreviation or simple letters, it is useless
November 11, 2016 at 5:01 pm #1191235Geoff B.
MemberGood 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.
November 14, 2016 at 6:11 am #1191783Geoff B.
MemberGood 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' );. Replacingminwithshortwill get you the results you are looking for.Let me know how that goes.
Best regards,
Geoff B.November 14, 2016 at 7:08 am #1191809Fadi
ParticipantThat’s it
ThanksNovember 15, 2016 at 10:32 am #1192628Geoff B.
MemberHey 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.
-
AuthorPosts
- The topic ‘Display days with 3 letters in mini calendar shortcode’ is closed to new replies.
