Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When in archive, variable or token for passed date #28

Open
b-creative opened this issue Feb 15, 2019 · 1 comment
Open

When in archive, variable or token for passed date #28

b-creative opened this issue Feb 15, 2019 · 1 comment

Comments

@b-creative
Copy link

Hi all,
We use News Articles for many things, also for a calender where it is important to show the future events (I use filter setting Show Pending for this). But when these dates (I set startdate and enddate) are passed I do not want the events to be visible anymore. This is standard for the normal listing but when I call a category listing I still see the events. Is there something I can do to prevent this? I was thinking about a new token... something like [ISPAST] or something. Or maybe there's a smart little workaround for this?

@b-creative
Copy link
Author

Hi,
Came up with a workaround.
I added an attribute to the surrounding div in Listing.Item.html:

data-date="[PUBLISHSTARTDATE:yyyy-MM-dd]"

I added a jQuery script in Listing.Footer.html:

<script> $(document).ready(function(e) { $('div.media').each(function(index, element) { event_day = $(this).attr('data-date'); event_day = new Date(event_day); today = new Date(); if(event_day.getTime() < today.getTime()) { $(this).css('display','none'); } console.log($(this).attr('data-date')); }); }); </script>

Now I can call a category with filter setting 'Show pending' selected and have articles in the past hidden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants