Change Beginning Start Date – Week Widget

Home Forums Calendar Products Events Calendar PRO Change Beginning Start Date – Week Widget

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1365071
    Jeff Bulzak
    Participant

    Hi,

    Here was my previous Post:

    Change Week Widget Start Date & Title

    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,
    Jeff

    #1365288
    Jeff Bulzak
    Participant

    Due 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.

    #1365772
    Victor
    Member

    Hi 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,
    Victor

    #1365895
    Victor
    Member

    Hi 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,
    Victor

    #1366212
    Jeff Bulzak
    Participant

    Hello 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.

    #1366470
    Victor
    Member

    Hi 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,
    Victor

    #1366529
    Jeff Bulzak
    Participant

    Hello 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,
    Jeff

    #1366922
    Victor
    Member

    That’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

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Change Beginning Start Date – Week Widget’ is closed to new replies.