Home › Forums › Calendar Products › Events Calendar PRO › limit number of events per calendar cell
- This topic has 15 replies, 4 voices, and was last updated 8 years, 10 months ago by Support Droid.
-
AuthorPosts
-
October 19, 2012 at 7:34 am #26855SandroParticipant
Hi,
Please check my website, on homepage you will see small calendar. I’d like to limit number of events that can be displayed per cell. Because right now on 19th of this month, there are too many events and calendar is getting stretched.
Is there a way to do this from GUI?
programatically?
October 19, 2012 at 7:03 pm #26903LeahMemberHey Sandro,
I see what you mean. Nice site by the way! Have you tried doing a template override in table.php? That’s my first idea, although I’m afraid I don’t know enough code to be more specific.
We’re closing up support for the weekend as usual, but if you need more help just let us know and I’ll send someone more knowledgeable your way on Monday.
Thanks for your patience!
~LeahOctober 21, 2012 at 1:26 am #26926SandroParticipantYes, Please I’d like to have assistance.
Problem is I’d like to have different limits on different calendars.
http://holiday.ge/
http://holiday.ge/events/I’d like to have limit of 4 on small calendar and limit of 6-7 on big calendar. So ideally I should be able to pass some kind of variable before table.php is included in the homepage.
ty.
October 22, 2012 at 2:04 pm #26983BarryMemberHi Sandro, Leah asked me to chip in here. What I would suggest is making a change to your custom events/table.php template.
You will find a function in there called display_day() … see my amended version here http://pastebin.com/ycH1jipB which dictates the number of displayed events per cell.
All you would really need to do is decide on how you want to control this (so you can change the variable in different situations). I’d recommend a filter, but really you should use whatever approach you are most comfortable with.
October 23, 2012 at 1:04 am #27018SandroParticipantHi, Barry.
That code worked perfectly, thanks!
1 more thing, I’d like to add (more…) link to the cell, so when there are more events and I display only 4, more link should appear. This is quite simple, I did it like this:
[code]
if (count( $monthView[$day] ) > $postsPerCell) {
echo ”.__(‘more’,’holidayge’).’…’;
} else {}
[/code]
But problem is the link itself. How do I link more to the specific day? I found this: tribe_get_linked_day($date, $day); but having trouble using it inside this function.October 23, 2012 at 5:59 am #27027BarryMemberHi Sandro – here’s another paste – see the final if block at the end of the function: http://pastebin.com/GqT7HLuL
Does that help?
October 23, 2012 at 6:11 am #27030SandroParticipantHi, something is not right. I get url: http://holiday.ge/events/1970-01-01/ on more link.
October 23, 2012 at 6:20 am #27034BarryMemberHmm, that’s strange as it works for me. Can you post your table.php code in its entirety via Pastebin so I can scope out what you’ve done?
October 23, 2012 at 6:23 am #27035SandroParticipantOctober 23, 2012 at 6:31 am #27036BarryMemberInteresting, your code works for me too!
So let’s try two things. First, change the relevant line of code in that final if block to read:
$date = date('Y-m-d', $start);
(Just in case this is some sort of internationalisation issue.) Second, if that still doesn’t work, straight after that can you temporarily insert the following line:
echo $start;
What I would hope and expect to see is a number such as 1351152000 – can you let me know what you see there?
October 23, 2012 at 6:38 am #27038SandroParticipanthm, with $date = date(‘Y-m-d’, $start); it worked perfectly! thanks! any ideas what is exact problem here? why this doesn’t creep out in other parts of the plugin?
October 23, 2012 at 6:46 am #27039BarryMemberWell, date_i18n() is documented as behaving as follows:
If the locale specifies the locale month and weekday, then the locale will take over the format for the date.
So conceivably what we might be left with is a string of text representing the date – but one which cannot then be successfully understood by PHP’s strtotime() function – resulting in it effectively being interpreted as a timestamp value of 0 (which is the first day in 1970).
October 23, 2012 at 12:01 pm #27064SandroParticipantI know, it is qtranslate plugin that breaks this.
Thank you so much! I really appreciate your help!
1 more issue, and I hope you will be able to help me. I’m trying to make frontpage calendar to display only specific category events. Is it possible to make a filter so if table.php is on homepage, only events from specific category will be populated?
Ideally I will have a variable $myCity on hopmepage, $myCity can be Paris or NewYork. Events calendar will also have categories “Paris” and “NewYork”, I want to use this variable to control display of calendar on homepage. So if $myCity == Paris, only events from that category will be loaded.
Is this possible? Any ideas how I would modify query to attain this?
October 23, 2012 at 12:25 pm #27067BarryMemberHey Sandro – could I ask you to ask this question in a separate thread? It makes it a lot easier for other users to research these topics in the future.
October 23, 2012 at 1:14 pm #27070 -
AuthorPosts
- The topic ‘limit number of events per calendar cell’ is closed to new replies.