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

69 lines
2.3 KiB
PHP
Raw Normal View History

2024-02-22 18:42:56 +01:00
<?php
/**
* Template part for displaying posts from category "agenda"
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Xarxaprod_theme
*/
?>
<aside id="agenda" class="agenda ">
<header>
<h2> <?php echo esc_html__('Agenda', 'xarxaprod'); ?></h2>
</header>
<main class="xarxaprod-agenda">
<?php
// https://developer.wordpress.org/reference/functions/get_posts/
// https://www.advancedcustomfields.com/resources/true-false/
$agenda_query = new WP_Query(
array(
'post_type' => array( 'post' ),
'post_status' => 'publish',
'posts_per_page' => '3',
'tax_query' => array (
array (
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'activitats','agenda'
2024-02-22 18:42:56 +01:00
)
)
) );
?>
<?php if ( $agenda_query->have_posts() ) : ?>
<?php while ( $agenda_query->have_posts() ) : $agenda_query->the_post(); ?>
<div class="xarxaprod-card-each xarxaprod-agenda-info-field">
<header class="entry-header">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark" class="">
<?php the_title( '<h3 class="entry-title">', '</h3>' ); ?>
</a>
</header><!-- .entry-header -->
<section class="activity-organizer organiza-activitat">
<?php if( get_field('xxp_agenda_who') ): ?>
<?php $allwhoproposes = get_field('xxp_agenda_who'); ?>
<p class="item-xxp-agenda-who">
<?php
foreach( $allwhoproposes as $eachwhoproposes ):
echo $eachwhoproposes['label'];
endforeach;
?>
</p>
<?php endif; ?>
2024-02-22 18:42:56 +01:00
</section>
<aside class="agenda-date agenda-data">
<?php if( get_field('xxp_agenda_date_start') ): ?>
<p class="item-xxp-agenda-date-start"><?php the_field('xxp_agenda_date_start'); ?></p>
<?php endif; ?>
2024-02-22 18:42:56 +01:00
</aside>
</div>
<?php endwhile;//end of the loop ?>
<?php wp_reset_postdata(); ?>
<?php else : //if no post in query ?>
<p class="no-content"></p>
<?php endif; //end query ?>
</main>
</aside>