• Resolved pearler

    (@pearler)


    Hi. I have setup 3 CPT’s named Students, Room and Rewards. Room has a relationship with Student and the Rewards lists rewards awarded to Students with a general number field named Value.

    I want to display the total summed value for a room. Not sure the best way to do this in the template. I am a newcomer to Pods.

    TIA

Viewing 1 replies (of 1 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @pearler

    You’ll need to use PHP for this and create a look where you add this number to an existing value.

    Something like:

    
    $rewards = array(); // << All rewards fetched from the students in the current rooms.
    $total = 0;
    foreach ( $rewards as $reward ) {
        $value = get_post_meta( $reward, 'reward_value_field', true );
        $total += $value;
    }
    
    echo $total;
    

    Keep in mind that this is pseudo code meant as an example.
    See your documentation for querying: https://docs.pods.io/code/pods/find/

    Cheers, Jory

Viewing 1 replies (of 1 total)
  • The topic ‘Need Help please’ is closed to new replies.