Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Created January 6, 2023 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfontjr/acd04d98880b674cfc4bc0cee58d327c to your computer and use it in GitHub Desktop.
Save vfontjr/acd04d98880b674cfc4bc0cee58d327c to your computer and use it in GitHub Desktop.
Count All Fom Entries
<?php
add_shortcode('count_form_entries', 'count_form_entries_callback');
function count_form_entries_callback( $atts ) {
$count = 0;
if ( !empty( $atts ) ) {
$atts = shortcode_atts( array(
'frm_id' => '0',
'frm_key' => ''
), $atts, 'count_form_entries' );
if ( isset($atts['frm_id']) && !empty($atts['frm_id']) && $atts['frm_id'] !== '0' ) {
$id = $atts['frm_id'];
} elseif ( isset($atts['frm_key']) && !empty($atts['frm_key']) && $atts['frm_key'] !== '0' ) {
$id = FrmForm::get_id_by_key( $atts['frm_key'] );
}
$count = FrmEntry::getRecordCount("form_id=". $id);
}
return $count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment