Home › Forums › Calendar Products › Events Calendar PRO › Month specific gridview title
- This topic has 7 replies, 4 voices, and was last updated 11 years, 11 months ago by Jonah.
-
AuthorPosts
-
May 25, 2012 at 4:49 am #19701MichelleParticipant
Hi – I am using the twenty-ten theme (&ECP Pro & Current WP install) and would like the title of my calendar gridview and listview to be ‘Events for (current month), 2012’ – so that the main title (just above the month selector) changes according to the month being viewed. Can I hardcode this into the ecp-page-template.php and if so what would be the code?
Thanks!May 25, 2012 at 9:42 am #19714RobMemberHi Michelle. Thanks for reaching out, and for your report of this. If I understand correctly what you’re going for, you should be able to accomplish what you’re going for by adding the following code to your functions.php:
add_filter(‘tribe_get_events_title’, ‘my_get_events_title’);
function my_get_events_title($title){
if( is_tax() ){
return $title;
}else{
return ‘My Title’;
}
}“My Title” would be renamed for the “Events for (current month) 2012.” You should be able to get what you need for the current month from the WordPress date/time codex (http://codex.wordpress.org/Formatting_Date_and_Time), but let me know if you have problems from there or if I’ve misunderstood the issue here.
May 25, 2012 at 11:28 pm #19744MichelleParticipantHi Rob – Thanks that works except I can’t work out what the right context is to return the current month in ‘My Title’. I tried ‘Events for [month], [year]’; as well as ‘Events for but these don’t work.
May 25, 2012 at 11:30 pm #19745MichelleParticipantAlso tried ‘Events for ‘ ;
May 25, 2012 at 11:31 pm #19746MichelleParticipantsorry my code didn’t paste – tried putting in ‘Events for then the php the_time string also.
May 27, 2012 at 11:57 am #19762javierParticipantHi Michelle and Rob!
I have copied the code and inserted it in the function.php, but it gives me an error with an unexpected T_STRING in the penultimate line. Why is this??I’ll wait for Michelle’s question to be answered to know how to do that too. Thanks!! 😉
May 29, 2012 at 8:33 am #19809RobMemberHey guys. Thanks for the follow-up here; while I’m not sure about this one myself, I’ve asked Jonah to take a look when he hits the forums later today. Stay tuned and thanks for your patience thus far.
May 29, 2012 at 9:56 pm #19886JonahParticipant@Michelle – I’ve followed up via email so look for my reply there.
@Javier – make sure the code uses single quotes and not apostrophes like so:
add_filter('tribe_get_events_title', 'my_get_events_title');
function my_get_events_title($title){
if( is_tax() ) {
return $title;
} else {
return 'My Title';
}
}
-
AuthorPosts
- The topic ‘Month specific gridview title’ is closed to new replies.