Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter vince91

    (@vince91)

    I saw how do it in the events list with the Event Attributes scope=future but not in the small calendar ? Can you point me in the right direction.

    Thanks

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    this is not possible by default, you’d need to override our template and code that in

    templates/templates/calendar-small.php

    https://wp-events-plugin.com/documentation/using-template-files/

    Thread Starter vince91

    (@vince91)

    Thanks for your answer.
    I want to override the em-calendar.php, and do something like you suggest in a previous post :

    if( $EM_Event->start > current_time() ){
    //show your booking here, otherwise it'll skip it.
    }

    But where to do it and with wich syntax ?

    Thanks

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    i think you may need to hire a developer to help you with this. try https://jobs.wordpress.net

    Thread Starter vince91

    (@vince91)

    Ok I will continue to search myself !

    by default the widget calendar td class just contains “eventfull” or “eventless” class. But you can add “past” class to give them a disabled style. To do this, duplicate “calendar-small.php” file to your_theme_folder/plugins/event-manager/
    Then around line 37 replace the following code:
    <td class="<?php echo $class; ?>">
    with:
    <td class="<?php echo $class; ?><?php if ($cell_data['date'] <= time()) { echo " past"; } ?>">

    now you can access this cell with css and give it a grey color, for example. removing the links inside the cell is a bad idea because google crawled them and then would redirect to a 404 page instead.

    Hi Nicmare – great solution – did you get this working, we have added the code to the site but it doesnt seem to create the class to target with the css.

    our amended code is…

    <td class="<?php echo $class; ?><?php if ($cell_data['date'] <= time()) { echo " past"; } ?>">
    					<?php if( !empty($cell_data['events']) && count($cell_data['events']) > 0 ): ?>
    					<a>" title="<?php echo esc_attr($cell_data['link_title']); ?>"><?php echo date('j',$cell_data['date']); ?></a>
    					<?php else:?>
    					<?php echo date('j',$cell_data['date']); ?>
    					<?php endif; ?>
    				</td>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Have we missed anything here?

    just follow my instructions. and check out this screenshot of my code: https://adrop.in/LLj

    Brilliant thanks for the swift reply and the screenshot, have you got a snippet of your css we can compare too?

    use firebug to inspect the mini calendar on left hand side: https://www.diva-schiff.de/
    there you see a lot of “past” events

    Nicmare
    Thanks so much – now working great- for some reason the php file for the calendar I’ve put in a templates folder in my child theme wasn’t overriding the original plugin templates but tested by applying to the originals and now working great

    Thanks for all your help

    Plugin Support angelo_nwl

    (@angelo_nwl)

    glad it’s working now.

    Anonymous User

    (@anonymized-1813274)

    Thanks for that!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘How to hide past events in calendar’ is closed to new replies.