1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
<?php
namespace SIW\Widgets;
class Quote extends Widget {
protected $widget_id ='quote';
protected $widget_dashicon = 'editor-quote';
protected function set_widget_properties() {
$this->widget_name = __( 'Quote', 'siw');
$this->widget_description = __( 'Toont quote van deelnemer', 'siw' );
}
function get_widget_form() {
$widget_form = [
'title' => [
'type' => 'text',
'label' => __( 'Titel', 'siw'),
'default' => __( 'Ervaringen van deelnemers', 'siw' ),
],
'category' => [
'type' => 'select',
'label' => __( 'Categorie', 'siw'),
'options' => siw_get_testimonial_quote_categories(),
]
];
return $widget_form;
}
protected function get_content( array $instance, array $args, array $template_vars, string $css_name ) {
$quote = siw_get_testimonial_quote( $instance['category'] );
ob_start();
?>
<div class="quote">
<div class="text">
"<?= esc_html( $quote['quote'] );?>"
</div>
<div class="volunteer">
<span class="name"><?= esc_html( $quote['name'] );?></span>
<span class="separator"> | </span>
<span class="category"><?= esc_html( $quote['project'] );?></span>
</div>
</div>
<?php
$content = ob_get_clean();
return $content;
}
}