salmancreation

givewp - grid post query

Jun 16th, 2021
1,018
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php if ( $tab_content['selected_donation_form'] ) :
  2.     $form_query = new WP_Query(
  3.         array(
  4.             'posts_per_page' => 1,
  5.             'post_type'      => 'give_forms',
  6.             'p'              => $tab_content['selected_donation_form'],
  7.         )
  8.     );
  9.     while ( $form_query->have_posts() ) : $form_query->the_post();
  10.         $stats = give_goal_progress_stats( get_the_ID() );
  11.         if ( $stats['raw_actual'] != 0 ) {
  12.             $bar_width = $stats['goal'] ? (int) ( $stats['raw_actual'] / $stats['raw_goal'] * 100 ) : 0;
  13.         }
  14.  
  15.         $lack_value = give_format_amount( $stats['raw_goal'] - $stats['raw_actual'] );
  16.  
  17.         if ( 'amount' === $stats['format'] ) {
  18.             $lack_amount = give_currency_filter( $lack_value );
  19.         } else {
  20.             $lack_amount = $lack_value;
  21.         }
  22.         ?>
  23.  
  24.         <?php if ( $stats['raw_actual'] != 0 ) : ?>
  25.             <div class="cr-donation-progress-bar">
  26.                 <div class="cr-donation-bar-container" style="width:<?php echo $bar_width; ?>%">
  27.                     <span class="cr-donation-bar-label"><?php echo $bar_width; ?>%</span>
  28.                 </div>
  29.             </div>
  30.         <?php endif; ?>
  31.  
  32.         <div class="status">
  33.             <ul class="cr-list-style cr-list-inline">
  34.                 <li><span class="label">goal</span><span class="amount"><?php echo $stats['goal']; ?></span></li>
  35.                 <li><span class="label">Raised</span><span class="amount"><?php echo $stats['actual']; ?></span></li>
  36.                 <li><span class="label">To Go</span><span class="amount"><?php echo $lack_amount; ?></span></li>
  37.             </ul>
  38.         </div>
  39.  
  40.     <?php endwhile;
  41.     wp_reset_query(); endif; ?>
RAW Paste Data