132 lines
4.5 KiB
PHP
132 lines
4.5 KiB
PHP
<?php
|
|
/**
|
|
* Gabarit d'article local (single.php) : catégorie, date, contenu, partage social sans traceur et navigation.
|
|
*
|
|
* @package CGT_FHA
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
get_header();
|
|
?>
|
|
|
|
<?php
|
|
while ( have_posts() ) :
|
|
the_post();
|
|
$cats = get_the_category();
|
|
$cat_obj = ! empty( $cats ) ? $cats[0] : null;
|
|
$share_url = get_permalink();
|
|
$share_txt = get_the_title();
|
|
?>
|
|
<section class="cgt-page-hero">
|
|
<div class="cgt-container--narrow">
|
|
<nav class="cgt-breadcrumb" aria-label="<?php esc_attr_e( 'Fil d\'Ariane', 'cgt-fha' ); ?>">
|
|
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php esc_html_e( 'Accueil', 'cgt-fha' ); ?></a>
|
|
<span aria-hidden="true">/</span>
|
|
<a href="<?php echo esc_url( cgt_fha_get_local_news_archive_url() ); ?>"><?php esc_html_e( 'Actualités', 'cgt-fha' ); ?></a>
|
|
<?php if ( $cat_obj ) : ?>
|
|
<span aria-hidden="true">/</span>
|
|
<a href="<?php echo esc_url( get_category_link( $cat_obj->term_id ) ); ?>"><?php echo esc_html( $cat_obj->name ); ?></a>
|
|
<?php endif; ?>
|
|
</nav>
|
|
<h1 class="cgt-page-hero__title"><?php the_title(); ?></h1>
|
|
</div>
|
|
</section>
|
|
|
|
<article id="post-<?php the_ID(); ?>" <?php post_class( 'cgt-article-wrap' ); ?>>
|
|
<div class="cgt-container--narrow">
|
|
<header class="cgt-article__header">
|
|
<div class="cgt-article__meta">
|
|
<?php if ( $cat_obj ) : ?>
|
|
<a href="<?php echo esc_url( get_category_link( $cat_obj->term_id ) ); ?>" class="cgt-pill-cat">
|
|
<?php echo esc_html( $cat_obj->name ); ?>
|
|
</a>
|
|
<?php endif; ?>
|
|
<time datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>">
|
|
<?php echo esc_html( get_the_date( 'j F Y' ) ); ?>
|
|
</time>
|
|
<span aria-hidden="true">•</span>
|
|
<span><?php esc_html_e( 'Union Locale CGT Foix Haute-Ariège', 'cgt-fha' ); ?></span>
|
|
</div>
|
|
</header>
|
|
|
|
<?php if ( has_post_thumbnail() ) : ?>
|
|
<div class="cgt-article__featured">
|
|
<?php the_post_thumbnail( 'cgt-featured', array( 'fetchpriority' => 'high' ) ); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="entry-content">
|
|
<?php
|
|
the_content();
|
|
|
|
wp_link_pages(
|
|
array(
|
|
'before' => '<div class="page-links">' . esc_html__( 'Pages :', 'cgt-fha' ),
|
|
'after' => '</div>',
|
|
)
|
|
);
|
|
?>
|
|
</div>
|
|
|
|
<!-- Partage social souverain (liens directs sans script traceur) -->
|
|
<aside class="cgt-share-box" aria-label="<?php esc_attr_e( 'Partager cet article', 'cgt-fha' ); ?>">
|
|
<span class="cgt-share-box__label"><?php esc_html_e( 'Partager cette information :', 'cgt-fha' ); ?></span>
|
|
<div class="cgt-share-box__actions">
|
|
<a
|
|
href="<?php echo esc_url( 'https://www.facebook.com/sharer/sharer.php?u=' . rawurlencode( $share_url ) ); ?>"
|
|
class="cgt-share-btn"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>Facebook</a>
|
|
<a
|
|
href="<?php echo esc_url( 'https://wa.me/?text=' . rawurlencode( $share_txt . ' — ' . $share_url ) ); ?>"
|
|
class="cgt-share-btn"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>WhatsApp</a>
|
|
<a
|
|
href="<?php echo esc_url( 'mailto:?subject=' . rawurlencode( $share_txt ) . '&body=' . rawurlencode( $share_url ) ); ?>"
|
|
class="cgt-share-btn"
|
|
>E-mail</a>
|
|
<button type="button" class="cgt-share-btn" data-cgt-copy-url="<?php echo esc_url( $share_url ); ?>">
|
|
<?php esc_html_e( 'Copier le lien', 'cgt-fha' ); ?>
|
|
</button>
|
|
</div>
|
|
</aside>
|
|
|
|
<?php
|
|
$prev_post = get_previous_post();
|
|
$next_post = get_next_post();
|
|
if ( $prev_post || $next_post ) :
|
|
?>
|
|
<nav class="cgt-post-nav" aria-label="<?php esc_attr_e( 'Navigation entre articles', 'cgt-fha' ); ?>">
|
|
<div>
|
|
<?php if ( $prev_post ) : ?>
|
|
<a href="<?php echo esc_url( get_permalink( $prev_post ) ); ?>" class="cgt-post-nav__item">
|
|
<span class="cgt-post-nav__dir">← <?php esc_html_e( 'Article précédent', 'cgt-fha' ); ?></span>
|
|
<strong><?php echo esc_html( get_the_title( $prev_post ) ); ?></strong>
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div>
|
|
<?php if ( $next_post ) : ?>
|
|
<a href="<?php echo esc_url( get_permalink( $next_post ) ); ?>" class="cgt-post-nav__item" style="text-align:right;">
|
|
<span class="cgt-post-nav__dir"><?php esc_html_e( 'Article suivant', 'cgt-fha' ); ?> →</span>
|
|
<strong><?php echo esc_html( get_the_title( $next_post ) ); ?></strong>
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</nav>
|
|
<?php endif; ?>
|
|
|
|
<?php do_action( 'cgt_fha_after_single_post', get_the_ID() ); ?>
|
|
</div>
|
|
</article>
|
|
<?php endwhile; ?>
|
|
|
|
<?php
|
|
get_footer();
|