xarxaprod-wp-theme/template-parts/section-eachconvo.php

104 lines
3.9 KiB
PHP
Raw Permalink Normal View History

<?php
/**
* Template part for displaying each convo with each field in category, archive, search
* to be used inside the loop.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Xarxaprod_theme
* @used_by page-template/convo-serach.php
* @used_by page-template/convo-archive.php
*
*/
?>
<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( get_field('xxp_convo_apply_begin') || get_field('xxp_convo_apply_end') || get_field('xxp_convo_espai_associat') || get_field('xxp_convoer_name')): ?>
<section class="xarxaprod-convo-info-fields">
<ul>
<li class="xarxaprod-convo-info-date">
<?php if( get_field('xxp_convo_apply_begin') || get_field('xxp_convo_apply_end') ): ?>
<dt>Termini</dt>
<dd class="xarxaprod-label item-xxp_convo_dates">
<?php if( get_field('xxp_convo_apply_begin') ): ?>
<span class="item-xxp_convo_apply_begin">del <?php the_field('xxp_convo_apply_begin'); ?> </span>
<?php endif; ?>
<?php if( get_field('xxp_convo_apply_end') && !get_field('xxp_convo_apply_begin') ){ echo 'fins'; } ?>
<?php if( get_field('xxp_convo_apply_end') ): ?>
<span class="item-xxp_convo_apply_end">al <?php the_field('xxp_convo_apply_end'); ?> </span>
<?php endif; ?>
<?php if( get_field('xxp_convo_apply_text') ): ?>
<span class="item-xxp_convo_apply_text"><?php the_field('xxp_convo_apply_text'); ?></span>
<?php endif; ?>
</dd>
<?php endif;//end xxp_convo_apply_begin or xxp_convo_apply_end ?>
</li>
<?php if( ! get_field('xxp_convo_espai_associat') ): ?>
<?php // read here howto ?>
<?php // https://www.advancedcustomfields.com/resources/relationship/#display-list-of-posts-with-setuppostdata ?>
<?php if( get_field('xxp_convoer_name') ): ?>
<li class="xarxaprod-convo-field">
<dt></dt>
<dd class="xarxaprod-convoer-name"><?php the_field('xxp_convoer_name'); ?></dd>
</li>
<?php endif; ?>
<?php else: //exists get_field('xxp_convo_espai_associat')?>
<?php $espai_associat_posts = get_field('xxp_convo_espai_associat'); ?>
<?php foreach( $espai_associat_posts as $thispost ): ?>
<?php // Setup this post for WP functions (variable must be named $post).?>
<li class="xarxaprod-convo-espai-associat">
<dt></dt>
<dd><a href="<?php echo ($thispost->guid);//the_permalink(); ?>"><?php echo ($thispost->post_title); ?><?php //the_title(); ?></a></dd>
</li>
<?php endforeach; ?>
<?php // Reset the global post object so that the rest of the page works correctly.?>
<?php endif; //end get_field('xxp_convo_espai_associat') ?>
</ul>
</section>
<?php endif;//end xxp_convo_apply_begin or xxp_convo_apply_end ?>
2024-03-14 11:35:02 +01:00
<section class="excerpt post-excerpt">
2024-03-14 11:35:02 +01:00
<?php //the_excerpt() ?>
<?php echo wp_trim_words(get_the_excerpt(), 30); // https://developer.wordpress.org/reference/functions/wp_trim_words/?>
</section>
2024-03-14 11:35:02 +01:00
<aside>
<?php get_template_part(
'template-parts/section',
'list-checkbox',
array('iterate_field' => 'xxp_convo_field')
); ?>
<?php get_template_part(
'template-parts/section',
'list-checkbox',
array('iterate_field' => 'xxp_convo_territory')
); ?>
<?php get_template_part(
'template-parts/section',
'list-checkbox',
array('iterate_field' => 'xxp_convo_service')
); ?>
</aside>
2024-03-14 11:35:02 +01:00
<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>
2024-03-14 11:35:02 +01:00
</article><!-- #post-<?php the_ID(); ?> -->