shortcode application
// Add Shortcode
function wd_cfes_app_output( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'id' => '',
'number' => '999999',
),
$atts
);
//in front-end admin class is not included
require_once( CFCORE_PATH . 'classes/admin.php' );
//get all entries (page 1 with 999999 entries per page should do it:)
$data = Caldera_Forms_Admin::get_entries( $atts['id'], 1, $atts['number'] );
ob_start();
?>
<style>
span.cf-entries-header {
font-weight: 900;
display: inline-block;
border: 2px solid black;
border-width: 0 0 2px 0;
}
div.cf-entries header+p {
margin: 0 0 10px 0;
}
p.cf-entry {
line-height: 1.25;
margin: 0 0 10px 0;
padding: 6px 12px;
}
p.cf-entry:nth-child(even) {
background: #e9e9e9;
}
p.cf-entry span {
display: inline-block;
vertical-align: middle;
}
span.cf-entries-header app-name,
p.cf-entry span.app-name {
width: 35%;
}
span.cf-entries-header page-name,
p.cf-entry span.page-name {
width: 55%;
}
span.cf-entries-header app-index,
p.cf-entry span.app-index {
width: 10%;
}
<div class="cf-entries">
<header><h3>Applications</h3></header>
<p>
<span class="cf-entries-header app-name">Application Name</span>
<span class="cf-entries-header page-name">Landing Page Name</span>
<span class="cf-entries-header app-index">App Index</span>
</p>
<?php
foreach ( (array)$data['entries'] as $entry ) {
echo '<p class="cf-entry">’ .
‘<span class="cf-app-name">' . $entry['data']['application_name'] . '</span>’ .
‘<span class="cf-page-name">' . $entry['data']['landing_page_name'] . '</span>’ .
‘<span class="cf-app-index">' . $entry['data']['app_index'] . '</span></p>';
};
?>
</div>
<?php
$output = ob_get_clean();
return $output;
};
}
add_shortcode( 'cf_app_entries', 'wd_cfes_app_output' );