limit number of events per calendar cell

Home Forums Calendar Products Events Calendar PRO limit number of events per calendar cell

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #26855
    Sandro
    Participant

    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?

    #26903
    Leah
    Member

    Hey 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!
    ~Leah

    #26926
    Sandro
    Participant

    Yes, 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.

    #26983
    Barry
    Member

    Hi 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.

    #27018
    Sandro
    Participant

    Hi, 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.

    #27027
    Barry
    Member

    Hi Sandro – here’s another paste – see the final if block at the end of the function: http://pastebin.com/GqT7HLuL

    Does that help?

    #27030
    Sandro
    Participant

    Hi, something is not right. I get url: http://holiday.ge/events/1970-01-01/ on more link.

    #27034
    Barry
    Member

    Hmm, 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?

    #27035
    Sandro
    Participant

    This is my custom table.php

    http://pastebin.com/tSUkygme

    ty 🙂

    #27036
    Barry
    Member

    Interesting, 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?

    #27038
    Sandro
    Participant

    hm, 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?

    #27039
    Barry
    Member

    Well, 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).

    #27064
    Sandro
    Participant

    I 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?

    #27067
    Barry
    Member

    Hey 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.

    #27070
    Sandro
    Participant
Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘limit number of events per calendar cell’ is closed to new replies.