| 1 |
<?php |
| 2 |
/** |
| 3 |
* Beaver Builder - Smart Post Show Module Frontend Template |
| 4 |
* |
| 5 |
* This file is automatically loaded by Beaver Builder when |
| 6 |
* rendering the module output on the frontend. |
| 7 |
* |
| 8 |
* The $module, $id, and $settings variables are available |
| 9 |
* automatically by Beaver Builder's rendering engine. |
| 10 |
* |
| 11 |
* @since 4.0.0 |
| 12 |
* @package Smart_Post_Show |
| 13 |
* |
| 14 |
* @var SPSB_Beaver_Smart_Post_Module $module The module instance. |
| 15 |
* @var string $id The module's unique node ID. |
| 16 |
* @var object $settings The module's saved settings. |
| 17 |
*/ |
| 18 |
|
| 19 |
if ( ! defined( 'ABSPATH' ) ) { |
| 20 |
exit; // Exit if accessed directly. |
| 21 |
} |
| 22 |
|
| 23 |
// Get the selected template ID from module settings. |
| 24 |
$template_id = isset( $settings->template_id ) ? (int) $settings->template_id : 0; |
| 25 |
|
| 26 |
// Show a placeholder if no template has been selected. |
| 27 |
if ( empty( $template_id ) ) : ?> |
| 28 |
<div style=" |
| 29 |
text-align: center; |
| 30 |
padding: 20px; |
| 31 |
border: 2px dashed #ccc; |
| 32 |
color: #999; |
| 33 |
font-size: 14px; |
| 34 |
"> |
| 35 |
<?php esc_html_e( 'Please select a Smart Post Show Template', 'post-carousel' ); ?> |
| 36 |
</div> |
| 37 |
<?php else : ?> |
| 38 |
<div class="sp-smart-post-builder-wrap" data-builderTemplateId="<?php echo esc_attr( $template_id ); ?>"> |
| 39 |
<?php |
| 40 |
// Execute the Smart Post Show shortcode and output the result. |
| 41 |
echo do_shortcode( '[smart_post id="' . $template_id . '"]' ); |
| 42 |
?> |
| 43 |
</div> |
| 44 |
<?php endif; ?> |