xarxaprod-wp-theme/template-parts/section-each-agenda-entry.php

71 lines
2.8 KiB
PHP

<?php
/**
* Template part for displaying posts from category "agenda"
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Xarxaprod_theme
* @used by template-parts/content-post.php
* @shown in : archive category
*
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('xarxaprod-card-each'); ?> >
<h3 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</h3>
<?php if ( has_post_thumbnail() ){?>
<figure class="xarxaprod-activitat-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
</a>
<img src="<?php echo get_the_post_thumbnail_url(); ?>" title="<?php the_title(); ?>" alt="imatge ilustra <?php the_title(); ?>" />
</figure>
<?php } else { ?>
<figure class="xarxaprod-activitat-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
</a>
<img src="<?php echo catch_post_first_image();?>" title="<?php the_title(); ?>" alt="imatge ilustra <?php the_title(); ?>" />
</figure>
<?php };?>
<aside class="xarxaprod-agenda-info">
<ul>
<li>
<dt>Data:</dt>
<?php if( get_field('xxp_agenda_date_start') || get_field('xxp_agenda_date_start') ): ?>
<?php if( get_field('xxp_agenda_date_start') ){ ?>
<dd class="item-xxp-agenda-date-start"><?php the_field('xxp_agenda_date_start'); ?></dd>
<?php } elseif ( get_field('xxp_agenda_date_end') ){ ?>
<dt>Fins al</dt>
<dd class="item-xxp-agenda-date-end"><?php the_field('xxp_agenda_date_end'); ?></dd>
<?php }; ?>
<?php endif; ?>
</li>
<?php if ( get_field('xxp_agenda_free_text') ){?>
<li>
<span class="item-xxp-agenda-free-text"><?php the_field('xxp_agenda_free_text'); ?></span>
</li>
<?php }; ?>
</ul>
</aside>
<?php if ( get_the_excerpt() ){ ?>
<section class="excerpt post-excerpt">
<?php //the_excerpt() ?>
<?php echo wp_trim_words(get_the_excerpt(), 22); // https://developer.wordpress.org/reference/functions/wp_trim_words/?>
</section>
<?php ; }?>
<nav class="more-link">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark" class="button button-more">
Més info
<span class="hide"><?php the_title(); ?></span>
</a>
</nav>
</article>