103 lines
3.8 KiB
PHP
103 lines
3.8 KiB
PHP
<?php
|
|
/**
|
|
* Template: Item de Actuación
|
|
*
|
|
* Variables disponibles:
|
|
* - $id, $title, $excerpt, $content, $permalink, $thumbnail
|
|
* - $iniciativas, $lineas, $widget, $type
|
|
* - $es_piloto, $direccion, $localidad, $latitud, $longitud
|
|
*
|
|
* @package Bloques_Transicion
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
$classes = ['bloques-item', 'bloques-item-actuacion'];
|
|
if ($widget === 'list') {
|
|
$classes[] = 'bloques-item-list';
|
|
}
|
|
if ($es_piloto) {
|
|
$classes[] = 'bloques-item-piloto';
|
|
}
|
|
?>
|
|
<article id="bloques-actuacion-<?php echo esc_attr($id); ?>" class="<?php echo esc_attr(implode(' ', $classes)); ?>">
|
|
<?php if ($thumbnail): ?>
|
|
<div class="bloques-item-thumbnail">
|
|
<a href="<?php echo esc_url($permalink); ?>">
|
|
<img src="<?php echo esc_url($thumbnail); ?>" alt="<?php echo esc_attr($thumbnail_alt ?: $title); ?>" loading="lazy">
|
|
</a>
|
|
<?php if ($es_piloto): ?>
|
|
<span class="bloques-badge bloques-badge-piloto">
|
|
<?php _e('Piloto', 'bloques-transicion'); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="bloques-item-content">
|
|
<header class="bloques-item-header">
|
|
<?php if (!empty($iniciativas)): ?>
|
|
<div class="bloques-item-taxonomies">
|
|
<?php foreach ($iniciativas as $term):
|
|
$color = get_field('color', $term);
|
|
$icono = get_field('icono', $term);
|
|
?>
|
|
<span class="bloques-tag bloques-tag-iniciativa" style="<?php echo $color ? '--tag-color: ' . esc_attr($color) . ';' : ''; ?>">
|
|
<?php if ($icono): ?>
|
|
<img src="<?php echo esc_url($icono); ?>" alt="" class="bloques-tag-icon">
|
|
<?php endif; ?>
|
|
<?php echo esc_html($term->name); ?>
|
|
</span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<h3 class="bloques-item-title">
|
|
<a href="<?php echo esc_url($permalink); ?>">
|
|
<?php echo esc_html($title); ?>
|
|
</a>
|
|
</h3>
|
|
</header>
|
|
|
|
<?php if ($excerpt): ?>
|
|
<div class="bloques-item-excerpt">
|
|
<?php echo wp_kses_post($excerpt); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($localidad || $direccion): ?>
|
|
<div class="bloques-item-location">
|
|
<span class="bloques-icon bloques-icon-location"></span>
|
|
<?php
|
|
$location_parts = array_filter([$direccion, $localidad]);
|
|
echo esc_html(implode(', ', $location_parts));
|
|
?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($lineas)): ?>
|
|
<div class="bloques-item-lineas">
|
|
<?php foreach ($lineas as $term):
|
|
$icono = get_field('icono', $term);
|
|
?>
|
|
<span class="bloques-linea-badge" title="<?php echo esc_attr($term->name); ?>">
|
|
<?php if ($icono): ?>
|
|
<img src="<?php echo esc_url($icono); ?>" alt="<?php echo esc_attr($term->name); ?>">
|
|
<?php else: ?>
|
|
<?php echo esc_html(mb_substr($term->name, 0, 1)); ?>
|
|
<?php endif; ?>
|
|
</span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<footer class="bloques-item-footer">
|
|
<a href="<?php echo esc_url($permalink); ?>" class="bloques-item-link bloques-btn">
|
|
<?php _e('Ver actuación', 'bloques-transicion'); ?>
|
|
</a>
|
|
</footer>
|
|
</div>
|
|
</article>
|