This week widget day header

Home Forums Calendar Products Events Calendar PRO This week widget day header

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1089442
    Niall
    Participant

    is there a way to change the date format of the .tribe-this-week-widget-header-date div in the This week widget?

    right now it displays: Thu 17th
    I’d like to change it to: Thursday March 17th 2016

    the loop-grid-day is calling:
    <div class=”tribe-this-week-widget-header-date”>
    <span class=”day”><?php echo esc_html( $day[‘formatted_day’] ); ?></span>
    <span class=”date”><?php echo esc_html( $day[‘formatted_date’] ); ?></span>
    </div>
    I’m not sure how to create and call the format I want,

    please advise and thanks so much in advance

    Andi

    #1089944
    Niall
    Participant

    I had to go into the plugin core to fix this

    I changed line 269 of This_week.php to:
    $display_date_format = apply_filters( ‘tribe_events_this_week_date_format’, ‘l, F jS, Y’ );

    and then called it from the template in my theme.

    that fixed the problem, but now I can’t update my plugin

    any suggestions?

    #1089978
    Brian
    Member

    Hi Again,

    To make changes to the plugin it is best to do it using hooks and the template system following our themer’s guide:

    https://theeventscalendar.com/knowledgebase/themers-guide/

    In this case you would want to edit this file:

    plugins/events-calendar-pro/src/views/pro/widgets/this-week/loop-grid-day.php

    Here in your theme:

    yourtheme/tribe-events/pro/widgets/this-week/loop-grid-day.php

    There you could take the date as formatted and change up how it displays.

    That would be safer for updates.

    Let me know if you have any follow up questions.

    Thanks

    #1090044
    Nico
    Participant

    Hello, i have the same problem. it now displays ma 14th and i want to change it into maandag 14 maart (dutch) i changed the directory to yourtheme/tribe-events/pro/widgets/this-week/loop-grid-day.php but i can’t find the right setting to change into the date format i want

    can you help me

    kind regards Nico

    #1090052
    Niall
    Participant

    sadly I can’t do that, the $display_date_format is created in the

    public static function this_week_query( $this_week_query_vars )

    I then reference it in the loop-grid.php.

    <?php echo esc_html( tribe_events_get_this_week_title( $this_week_template_vars[‘start_date’] ) ); ?>

    thanks for your feedback though!!!

    • This reply was modified 10 years, 1 month ago by Niall.
    #1090147
    Nico
    Participant

    But i still have also a problem my day and date is displayed as: mo 14th and i want it to be displayed as: maandag 14 maart therefore i need to change these lined:

    <span class=”day”><?php echo esc_html( $day[‘formatted_day’] ); ?></span>
    <span class=”date”><?php echo esc_html( $day[‘formatted_date’] ); ?></span>

    do you know what i need to place instead of formatted_day and formatted_date to get the results displayed as: maandag 14 maart instead of ma 14th

    hope one of you can help me

    #1090236
    Niall
    Participant

    Hi Nico,
    I deleted the first line

    <span class=”day”><?php echo esc_html( $day[‘formatted_day’] ); ?></span>

    and then went into This_Week.php (its in the plugin folder inside the pro version, Pro/Src/Tribe

    change this:
    $display_date_format = apply_filters( ‘tribe_events_this_week_date_format’, ‘jS’ );

    to this:
    $display_date_format = apply_filters( ‘tribe_events_this_week_date_format’, ‘l, F jS, Y’ );

    that puts it into the correct format (at least that the format I want, you can change it, just google “date format wordpress”)

    the only prob is that I’ve changed my core files so I’ll have to track this when I do updates (like the one I did last night)

    I wish I knew how to put this change into my theme, maybe there is a way to put the function into my theme’s functions file…

    If anyone knows how to do this please chime in

    #1090642
    Brian
    Member

    Hi Nico,

    You can try what Andrea did, but it is not recommended as the plugin with overwrite those changes.

    It is not possible to edit a method from your theme as it is the templates.

    Beyond that I do not have information on how to make a customization such as this.

    Thanks

    #1090916
    Niall
    Participant

    can I place the method in my theme’s functions.php file and have it override the one in the plugin core?

    #1090960
    Brian
    Member

    Hi Andrea,

    That is not possible. PHP does not work that way.

    #1091060
    Niall
    Participant

    okie dokie, thanks anyway

    #1091175
    Brian
    Member

    You’re Welcome.

    Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.

    Thanks

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘This week widget day header’ is closed to new replies.