Support

Account

Home Forums ACF PRO Custom post query with multiple fields with number values. Totalisation needed Reply To: Custom post query with multiple fields with number values. Totalisation needed

  • You need to create variable that keep a running total. For example:

    
    $counter = 0;
    while ($query->have_posts()) {
      $query->the_post();
      if (get_field('field_name') == 1) {
        $counter++;
      }
    }
    echo $counter;