Template Override Not Working

Home Forums Calendar Products Events Calendar PRO Template Override Not Working

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1001462
    Elizabeth City EMC
    Participant

    When I view my calendar on an iPhone screen, the days of the week in month view overlap one another. I searched and found the knowledgebase article, “Change the days of the week to abbreviations,” and followed the instructions, but it does not appear as though the template override is working. Is there something I am missing? Or is there a better way to change to abbreviations for the days of the week when viewed on an iPhone screen using media queries?

    #1001669
    Geoff
    Member

     

    Howdy Elizabeth City and welcome to the forums!

    Shoot, so for the trouble here. I just tried the steps in that article myself and everything seemed to work out. I even tried it using the Twenty Thirteen theme, just like you.

    I wonder if perhaps something is quite in place. Will you please go ahead and clear the template override from the article so we can start fresh? Here’s a step-by-step approach of how I got it to work:

    • Make a copy of the loop-grid.php template. It is located in /plugins/the-events-calendar/src/views/month/loop-grid.php.
    • Make a new folder in your Twenty Thirteen theme directory called tribe-events.
    • Make a new folder in that one called month.
    • Drop the copied loop-grid.php file in that last folder.

    Now that the loop-grid.php template is in your theme directory, it can be modified to suit your needs. In this case, replace this (Line 27 for me):

    <th id="tribe-events-<?php echo esc_attr( strtolower( $day ) ); ?>" title="<?php echo esc_attr( $day ); ?>" data-day-abbr="<?php echo esc_attr( $wp_locale->get_weekday_abbrev( $day ) ); ?>"><?php echo $day ?></th>

    …with this:

    <?php $short_day = esc_attr( $wp_locale->get_weekday_abbrev( $day ) ); ?>
    <th id="tribe-events-<?php echo esc_attr( strtolower( $day ) ) ?>" title="<?php echo $short_day ?>" data-day-abbr="<?php echo $short_day ?>"><?php echo $day ?></th>

    That shortened the days of the week in my Month View from full names to 3-letter abbreviations (screenshot).

    Does following that fresh set of steps help make any difference? Please let me know!

    Geoff

     

    #1001750
    Elizabeth City EMC
    Participant

    Nope. Same problem as before. I followed your steps exactly, several times over. No difference.

    However, I did switch to the twentyfourteen theme, which I have not tweaked in any way, and the solution worked. So there is definitely something wrong with my own customized version of twentythirteen.

    #1002060
    Geoff
    Member

    Hi Elizabeth City and thanks for following up!

    Shoot, I’m really sorry that didn’t do the trick, though I’m glad to hear it does working a default theme.

    It’s going to be really tough for me to troubleshoot this since it seems to be directly related to a customization in the theme. My advice is to check through your custom work to see where any changes default behavior–whether it’s in the functions or other imported scripts–might be preventing the template override from working as it should.

    Of course, you could directly modify the templates in the plugin directory. However, I tend to discourage that since any update to the plugin would overwrite and lose your work.

    Sorry I don’t have a solid solution for you here but I’d be happy to answer any questions as best I can!

    Geoff

    #1002089
    Elizabeth City EMC
    Participant

    Ok, thanks, Geoff. I’ll report back if I discover what the problem is.

    #1002094
    Geoff
    Member

    Awesome! I’ll leave this thread open in the meantime. 🙂

    #1004753
    Kishore
    Participant

    I want to do template override in my custom plugin. How can i do for event-list file inside my custom plugin?

    #1004881
    Geoff
    Member

    Hello @Kishore,

    Thanks for chiming in here! That’s a good question and is covered very thoroughly here in our Themer’s Guide. Please feel free to check that out. And, if you still have questions, please do open a new thread and we’d be happy to help you out there. 🙂

    Cheers!
    Geoff

    #1007343
    Elizabeth City EMC
    Participant

    Geoff, I think I figured out how to fix my problem. You told me to insert the following code:

    <?php $short_day = esc_attr( $wp_locale->get_weekday_abbrev( $day ) ); ?>
    <th id="tribe-events-<?php echo esc_attr( strtolower( $day ) ) ?>" title="<?php echo $short_day ?>" data-day-abbr="<?php echo $short_day ?>"><?php echo $day ?></th>

    I noticed that everywhere $short_day appeared the month abbreviation was showing up, so I simply changed that final $day to $short_day and it worked. Was it really that easy, or did I just break something somewhere else? LOL

    #1007525
    Geoff
    Member

    I think you nailed it! I was working with the abbreviated version of the day name, but that’s awesome. Thanks for following up and nice work!

    I’ll go ahead and close this thread but do please hit us up if there’s anything else we can do to help. 🙂

    Cheers!
    Geoff

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Template Override Not Working’ is closed to new replies.