Ok, so I’ve been messing around with this and the easiest way I could think of was to download a PHP snippet tool that allows me to create PHP code, then it gives me a shortcode that I can put on any post/page on my site.
I used the below code, which gives me all entries for 2016 and I will then have to make more snippets for the other years. The filter I used is a modified version of the filter I saw in the Sticky List documentation. It would be nice if I could replace the unset string so that I could just use one if statement, but everything I tried didn’t work. I guess every year I’ll just have to go and add last year’s date range to my snippets… oh well.
13pixar/fried_eggz – it would be great if you could build this in somehow so we could just use date ranges out of the box; I didn’t want to add this to my functions.php and have all of my stickylists limited..
Hope this helps!!
<?php
add_filter('filter_entries','hide_some_rows' );
function hide_some_rows($entries) {
foreach ($entries as $entryKey => $entryValue) {
if ($entryValue["date_created"] >= "2019-01-01 00:00:00" && $entryValue["date_created"] <= "2019-12-31 23:59:59") {
unset($entries[$entryKey]);
}
if ($entryValue["date_created"] >= "2018-01-01 00:00:00" && $entryValue["date_created"] <= "2018-12-31 23:59:59") {
unset($entries[$entryKey]);
}
if ($entryValue["date_created"] >= "2017-01-01 00:00:00" && $entryValue["date_created"] <= "2017-12-31 23:59:59") {
unset($entries[$entryKey]);
}
}
return $entries;
}
?>
<H1>Adoption Applications</H1>
<?php
echo do_shortcode("[stickylist id='4']");
?>
<br><H1>Adoption Contracts</H1>
<?php
echo do_shortcode("[stickylist id='5']");
?>