Support » Plugin: Gravity Forms Sticky List » Date Ranges

  • Anyone have any ideas about how I limit entries to a certain date range for a given form/list? I want to do this for several forms/lists on the same page. For example, I want to be able to show all applications (stickylist id=”1″) and all contracts (stickylist id=”2″) from 2017 on the same page on my site. I then want to do the same thing on another page for 2018, etc.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Just checking up on this, don’t want it to auto-close the post.

    Any news about it?

    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']");
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Date Ranges’ is closed to new replies.