• suracethapa

    (@suracethapa)


    I want to display the entries with the fields value from 50 to 100. I see the shortcodes displaying list from field value.

    Can we display all the list that a fields contains value from 50 to 100 or any value interval?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author fried_eggz

    (@fried_eggz)

    Absolutely. You can use a filter.

    add_filter('filter_entries','hide_some_rows' );
    function hide_some_rows($entries) {
        foreach ($entries as $entryKey => $entryValue) {
            $number = intval($entryValue["9"]);
            if ( $number < 50 || $number > 100 ) {
                unset($entries[$entryKey]);
            }
        }
        return $entries;
    }

    The above code, when placed in functions.php would remove all rows from the list where the value of field id 9 is not between 50 and 100.

    Note that you need to change $entryValue["9"] to the id of the field that you want to check.

    Thread Starter suracethapa

    (@suracethapa)

    Thank you! I will try this.

    Thread Starter suracethapa

    (@suracethapa)

    It worked Thank you!

    I have one more question.
    I want to display the entries in different table for different values.
    Example
    if the values if from 50- 100
    // display table with field value 50 -100
    if the values if from 101 – 200
    //display table with field value 101 – 200

    It is fine if I need to create a template.
    Is this possible ?

    Thanks

    Plugin Author fried_eggz

    (@fried_eggz)

    Do you need these tables to be present on the same page? If not, you can modify the code above to check the current page and filter entries accordingly.

    Thread Starter suracethapa

    (@suracethapa)

    Yes, I need all the tables on the same page. I am trying to display the donar list categorised by amount. Example
    0-100
    Donar A
    Donar B

    100-200
    Donar A
    Donar B

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can we display the entry list with the value 50-100 ?’ is closed to new replies.