Skip to content

Instantly share code, notes, and snippets.

@New0
Created February 12, 2018 15:54
Show Gist options
  • Save New0/3f315e11e434cebc1d9eb934ce5bf91b to your computer and use it in GitHub Desktop.
Save New0/3f315e11e434cebc1d9eb934ce5bf91b to your computer and use it in GitHub Desktop.
Use the the_content filter hook to display Caldera Forms entries
<?php
add_filter( 'the_content', function() {
//Replace the number with the page ID to display entries on
if ( is_page('2' ) ) {
require_once( CFCORE_PATH . 'classes/admin.php' );
//Be sure to set the correct form ID below
$form_id = 'CF5a5e8452c6f82';
//get all entires (page 1 with 9999999 entries per page should do it:)
$data = Caldera_Forms_Admin::get_entries( $form_id, 1, 9999999 );
//$data has extra meta info. $entries has just the entries
$entries = $data[ 'entries' ];
foreach( $entries as $entry ) {
echo '<div class="mydata">
<span>' . $entry['data']['first_name'] . '</span>
<span>' . $entry['data']['last_name'] . '</span>
<span>' . $entry['data']['email_address'] . '</span>
</div>';
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment