Home › Forums › Calendar Products › Events Calendar PRO › Change Beginning Start Date – Week Widget
- This topic has 8 replies, 2 voices, and was last updated 8 years, 6 months ago by
Jeff Bulzak.
-
AuthorPosts
-
October 17, 2017 at 7:12 pm #1365071
Jeff Bulzak
ParticipantHi,
Here was my previous Post:
I managed to overwrite the template to make the necessary adjustments for almost all items. The issue I am having is that the First date of the Calendar is not Today.
Website: http://www.BocaCal.com (See Sidebar)
In the previous thread I was provided the file to view and I narrowed down the area of the PHP file to adjust. The problem I am having is I cannot figure it out from here.
/** * This Week Widget - Get the first day of current week with provided date or current week * * @param null|mixed $date given date or week # (week # assumes current year) * @param null $week_offset # offset from current week the start date for this widget * * @return DateTime */ function tribe_get_this_week_first_week_day( $date = null, $week_offset = null ) { //Start of Week in WordPress Settings - Zero = Sunday, 1 = Monday, etc $offset = 0 - get_option( 'start_of_week', 0 ); //Check for Valid Date try { $date = new DateTime( $date ); } catch ( exception $e ) { $date = new DateTime(); } // Clone to avoid altering the original date $r = clone $date; //Use Offset to get Start of Week for Widget $r->modify( - ( ( $date->format( 'w' ) + $offset ) % 7 ) . 'days' ); //Add Week Offset if there empty( $week_offset ) ? null : $r->modify( '+' . absint( $week_offset ) . ' weeks' ); return $r->format( Tribe__Date_Utils::DBDATEFORMAT ); }Any help would be greatly appreciated – Thanks!
Regards,
JeffOctober 18, 2017 at 5:30 am #1365288Jeff Bulzak
ParticipantDue to the error, I’ve moved the Week at a Glance issue over to a new page, here it is:
http://bocacal.com/fixing-sidebars/Any help is greatly appreciated.
October 18, 2017 at 8:23 pm #1365772Victor
MemberHi Jeff!
Thanks for getting in touch again! Let me try to help you with this topic.
I’ve just had a look at the code and it seems there is no easy way to accomplish what you are looking for. I tried to look for a way to customize the this week widget but could not find a direct way to do so.
I will reach out to the team to have a second pair of eyes on this and will get back to you.
In the meantime, have you checked the Event List Shortcode > https://theeventscalendar.com/knowledgebase/pro-widget-shortcodes/#event-list-shortcode ? You might want to have a look at it and see if it works as an alternative to what you are trying to accomplish. Let me know about it.
Best,
VictorOctober 19, 2017 at 6:45 am #1365895Victor
MemberHi Jeff!
Barry managed to come up with a snippet that will accomplish what you are looking for the This Week Widget. Try the following code and see if it works for you:
https://gist.github.com/vicskf/9b05e51cb4d7219f631964e91a5b5f2b
Best,
VictorOctober 19, 2017 at 3:34 pm #1366212Jeff Bulzak
ParticipantHello Victor,
I gave this a try and it seems to be working, however, none of my events that are running today are showing up. I added it to the bottom of the file, could this be why, should have I overwritten what was previously there?
Thank you.
October 20, 2017 at 6:57 am #1366470Victor
MemberHi Jeff!
Where are you currently placing the code snippet? You should be pasting the code into your active theme’s functions.php file.
You mentioned before that you were already customizing the widget somehow, try using the snippet without anything else and see how it works.
Let me know about it.
Best,
VictorOctober 20, 2017 at 9:02 am #1366529Jeff Bulzak
ParticipantHello Victor,
It appears to be working – not really sure what I did before for it not to work.
Thank you for the prompt support.
Regards,
JeffOctober 20, 2017 at 5:53 pm #1366922Victor
MemberThat’s great to know Jeff! Thanks for following up to let us know about it.
I’ll close this now, but feel free to open a new topic if anything comes up and we’d be happy to help!
Have a great weekend!
Victor -
AuthorPosts
- The topic ‘Change Beginning Start Date – Week Widget’ is closed to new replies.
