Change days column titles in calendar widget

Home Forums Calendar Products Events Calendar PRO Change days column titles in calendar widget

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1022799
    Adage
    Participant

    Hello,
    I use the calendar widget in French and it loads L MA ME J V S D
    I want both MA ME to become simple M, in order to have better alignment.
    Where can I set that up ?
    Thank you.

    #1023110
    Brian
    Member

    Hi,

    Thanks for using our plugins. I can try to help out here.

    That template is found out here:

    plugins/events-calendar-pro/src/views/pro/widgets/mini-calendar/grid.php

    You can follow our themer’s guide to move it to your theme:

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

    There you can modify this to get a different output.

    <?php foreach ( $days_of_week as $day ) : ?>
    <th class="tribe-mini-calendar-dayofweek"><?php echo $day ?></th>
    <?php endforeach; ?>

    I can try to help answer some questions about it to get you started, but I am limited in supporting this much beyond this.

    Let me know if you have any follow up questions.

    Thanks

    #1023180
    Adage
    Participant

    Hello,

    Your solution is to change the code ; I don’t want to change the code, juste the translation.

    M (for Monday) is translated L (for Lundi) in French ;
    TU (for TUesday) is translated MA (for MArdi) in French ;
    W (for Wednesday) is translated ME (for MErcredi) in French.

    What I want is to change the translations of “TU -> MA” to “TU -> M” and from “W -> ME” to “W -> M”.

    Thank you.

    #1023230
    Brian
    Member

    Sorry, but changing the coding is the only way possible as the Names come from PHP itself.

    So if you do not want to change the coding then unfortunately, there is no way to do this.

    Thanks

    #1023236
    Adage
    Participant

    Here is the code I have in the file you shown :

    <?php
    /**
     * Mini Calendar Widget Grid Template
     * This file loads the mini calendar widget grid
     *
     * Override this template in your own theme by creating a file at [your-theme]/tribe-events/pro/widgets/mini-calendar/grid.php
     *
     * @package TribeEventsCalendar
     *
     */
    if ( ! defined( 'ABSPATH' ) ) {
    	die( '-1' );
    } ?>
    
    <?php
    $days_of_week = tribe_events_get_days_of_week( 'min' );
    $week         = 0;
    
    ?>
    <div class="tribe-mini-calendar-grid-wrapper">
    	<table class="tribe-mini-calendar" <?php tribe_events_the_mini_calendar_header_attributes() ?>>
    		<?php do_action( 'tribe_events_mini_cal_before_header' ); ?>
    		<thead class="tribe-mini-calendar-nav">
    		<tr>
    			<td colspan="7">
    				<div>
    					<?php tribe_events_the_mini_calendar_prev_link() ?>
    					<span id="tribe-mini-calendar-month"><?php tribe_events_the_mini_calendar_title() ?></span>
    					<?php tribe_events_the_mini_calendar_next_link() ?>
    					<img />" alt="loading..." />
    				</div>
    			</td>
    		</tr>
    		</thead>
    		<?php do_action( 'tribe_events_mini_cal_after_header' ); ?>
    		<?php do_action( 'tribe_events_mini_cal_before_the_grid' ); ?>
    		<thead>
    		<tr>
    			<?php foreach ( $days_of_week as $day ) : ?>
    				<th class="tribe-mini-calendar-dayofweek"><?php echo $day ?></th>
    			<?php endforeach; ?>
    
    		</tr>
    		</thead>
    
    		<tbody class="hfeed vcalendar">
    
    		<tr>
    			<?php while ( tribe_events_have_month_days() ) :
    			tribe_events_the_month_day(); ?>
    			<?php if ( $week != tribe_events_get_current_week() ) :
    			$week ++; ?>
    		</tr>
    		<tr>
    			<?php endif; ?>
    			<td class="<?php tribe_events_the_month_day_classes() ?>">
    				<?php tribe_get_template_part( 'pro/widgets/mini-calendar/single-day' ) ?>
    			</td>
    			<?php endwhile; ?>
    		</tr>
    		</tbody>
    		<?php do_action( 'tribe_events_mini_cal_after_the_grid' ); ?>
    	</table>
    </div> <!-- .tribe-mini-calendar-grid-wrapper -->

    Where are the M TU W TH F SA SU or L MA ME J V S D ?

    Thank you.

    • This reply was modified 10 years, 5 months ago by Adage.
    #1023494
    Brian
    Member

    This is the foreach statement that echos the titles:

    <?php foreach ( $days_of_week as $day ) : ?>
    <th class="tribe-mini-calendar-dayofweek"><?php echo $day ?></th>
    <?php endforeach; ?>

    You might be able to change it to something like this to change the output:


    <?php foreach ( $days_of_week as $day ) :
    if ( $day == 'MA' ) {
    $day = 'M';
    } elseif ( $day == 'ME' ) {
    $day = 'M';
    } ?>
    <th class="tribe-mini-calendar-dayofweek"><?php echo $day ?></th>
    <?php endforeach; ?>

    Cheers

    #1075503
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Change days column titles in calendar widget’ is closed to new replies.