Advertisement
geminilabs

[site-reviews] custom singular/plural summary text

Jun 22nd, 2019
240
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $counts = (array) get_post_meta( get_the_ID(), '_glsr_count', true );
  2. $counts = wp_parse_args( $counts, ['local' => []] );
  3. $counts = intval( array_sum( $counts['local'] ));
  4. $text = _n( '{num} customer review', '{num} customer reviews', $counts, 'storefront-child' );
  5. echo do_shortcode( '[site_reviews_summary assigned_to=post_id text="'.$text.'"]' );
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement