Home › Forums › Calendar Products › Events Calendar PRO › Display Current Month Title Being Viewed in Calendar Grid View
- This topic has 7 replies, 2 voices, and was last updated 13 years ago by
Jonah.
-
AuthorPosts
-
April 19, 2013 at 11:39 am #46343
likemindsdesigns
ParticipantHello,
I want to display the Month Name and Year of the month being viewed in Calendar Grid View. For example, if the user is looking at April 2013, I want it to say “April 2013” above the calendar. Then if they click the next arrow, I want it to say “May 2013” above the calendar.I have tried using the functions in my calendar grid view template ‘tribe_get_current_month_text()’ and ‘tribe_get_displayed_month()’ but they only display April (the current month). How do I get the text displayed for the month VIEWED.
April 19, 2013 at 11:42 am #46344likemindsdesigns
ParticipantBy the way, the function ‘tribe_get_displayed_month()’ does display the Month Year like I want it to.
However, my problem is that it only shows correctly if I force refresh my browser each time a view a different month. So the calendar refreshes the Ajax but not the browser when I use the next/previous links.
April 19, 2013 at 12:58 pm #46374Jonah
ParticipantHi likemindsdesigns,
You should be able to accomplish this by using the following in your /wp-content/plugins/the-events-calendar/views/gridview.php file. Make sure to make a copy and place in an ‘events’ folder before you make changes. I added this to line 22 and it works for me: http://snippi.com/s/9qmtppj
Does that help?
April 20, 2013 at 4:59 pm #46428likemindsdesigns
ParticipantHi Jonah,
No, the problem with that is that the month “April” displays even when a user hits the May–> forward button. The only way to get the correct month to display is to refresh the page. However, the calendar refreshes the Ajax, and not the overall page. How can I force refresh?http://mscra.com/events/2013-03/
http://mscra.com/events/2013-04/
(By the way, wish there was a way to send screen captures to illustrate problem). Thank you for your help!April 21, 2013 at 11:38 am #46453likemindsdesigns
Participant** SOLVED **
I am posting this solution if it will help any other users.FIRST, I was placing the function to get month text outside of the Ajax div. By placing it inside, I was able to get the refresh feature I wanted.
SECOND, I created a new function to get current year text. I added this function to the file “calendar.php”:
/**
* Current Year Text
*
* Returns a textual description of the current year
*
* @return string Name of the current year.
* @since 2.0
*/
function tribe_get_current_year_text( ) {
return date( ‘Y’, strtotime( tribe_get_month_view_date() ) );
}
THIRD, I updated my “gridview.php” template to include this line:I hope this will help someone. Thank you for your help Jonah! I suggest adding that Get Year text function to the next release.
April 21, 2013 at 11:39 am #46454likemindsdesigns
ParticipantInclude this line in gridview.php:
April 21, 2013 at 11:40 am #46455likemindsdesigns
ParticipantOk, sorry it is not letting me post PHP code. Basically you want to add the line to echo the functions to get month text and join that with get year text. Hope this will help!
April 22, 2013 at 8:33 am #46513Jonah
ParticipantHi likemindsdesigns,
Thanks for posting your solution. Sorry about our code posting troubles, I suggest posting to code to http://snippi.com/ and then sharing the link here.
Regards,
Jonah -
AuthorPosts
- The topic ‘Display Current Month Title Being Viewed in Calendar Grid View’ is closed to new replies.
