feed.php
66 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Smash Balloon Reviews Feed Main Template |
| 5 | * Creates the wrapping HTML and adds settings as attributes |
| 6 | * |
| 7 | * @version 1.0 Reviews Feed by Smash Balloon |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * Add HTML or execute code before the feed displays. |
| 13 | * sbr_after_feed works the same way but executes |
| 14 | * after the feed |
| 15 | * |
| 16 | * @param array $posts Instagram posts in feed |
| 17 | * @param array $settings settings specific to this feed |
| 18 | * |
| 19 | * @since 2.2 |
| 20 | */ |
| 21 | if (!defined('ABSPATH')) { |
| 22 | exit; // Exit if accessed directly |
| 23 | } |
| 24 | use SmashBalloon\Reviews\Common\Parser; |
| 25 | |
| 26 | $parser = new Parser(); |
| 27 | do_action('sbr_before_feed', $posts, $settings); |
| 28 | |
| 29 | $classes = $this->feed_classes($settings); |
| 30 | $misc_atts = $this->misc_atts(); |
| 31 | ?> |
| 32 | <section id="<?php echo esc_attr(sbr_container_id($feed_id)); ?>" class="sbr-feed" aria-label="<?php esc_attr_e('Customer reviews', 'reviews-feed'); ?>"> |
| 33 | <?php |
| 34 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- error_html() returns safe HTML |
| 35 | echo $this->error_html(); |
| 36 | ?> |
| 37 | <section class="sb-feed-container <?php echo esc_attr($classes); ?>" data-layout="<?php echo esc_attr($settings['layout']); ?>" data-gutter="<?php echo esc_attr($settings['horizontalSpacing']); ?>" data-post-style="<?php echo esc_attr($settings['postStyle']); ?>" data-shortcode-atts="<?php echo esc_attr($shortcode_atts); ?>" data-feed-id="<?php echo esc_attr($feed_id); ?>"<?php |
| 38 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- misc_atts() returns safe HTML attributes |
| 39 | echo $misc_atts; |
| 40 | ?>> |
| 41 | <?php if ($this->should_show('header')) : |
| 42 | include sbr_get_feed_template_part('header', $settings); |
| 43 | endif; ?> |
| 44 | |
| 45 | <div class="sb-feed-posts" data-icon-size="small" data-avatar-size="medium"<?php if (($settings['layout'] ?? '') !== 'carousel') : // Owl re-wraps slides, breaking list structure ?> role="list"<?php endif; ?>> |
| 46 | <?php $this->posts_loop($posts, $settings); ?> |
| 47 | </div> |
| 48 | |
| 49 | <div class="sbr-feed-status sbr-screenreader" role="status" aria-live="polite" aria-atomic="true"></div> |
| 50 | |
| 51 | <?php |
| 52 | /** |
| 53 | * Things to add before the closing "div" tag for the main feed element. Several |
| 54 | * features rely on this hook such as local images and some error messages |
| 55 | * |
| 56 | * @param object Feed |
| 57 | * @param string $feed_id |
| 58 | * |
| 59 | * @since 1.0 |
| 60 | */ |
| 61 | do_action('sbr_before_feed_end', $this, $feed_id); ?> |
| 62 | </section> |
| 63 | </section> |
| 64 | |
| 65 | <?php do_action('sbr_after_feed', $posts, $settings);?> |
| 66 |