added agenda seciont template

This commit is contained in:
jorge-vitrubio 2024-02-22 18:42:56 +01:00
parent 86c753a7ff
commit 7a2a92c589
1 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,55 @@
<?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'
)
)
) );
?>
<?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="tipus-activitat agenda-tipus-activitat">
</section>
<aside class="agenda-date agenda-data">
</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>