-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
97 lines (86 loc) · 3.48 KB
/
header.php
File metadata and controls
97 lines (86 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<script>/* Prevent flash of wrong theme; signal JS early for progressive enhancement */(function(){var t=localStorage.getItem('laccio-theme');if(t)document.documentElement.setAttribute('data-theme',t);document.documentElement.classList.add('js');})();</script>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<a href="#main-content" class="skip-link"><?php esc_html_e( 'Vés al contingut', 'laccio' ); ?></a>
<!-- Compact sticky header (desktop, activated by JS + IntersectionObserver) -->
<div class="sticky-bar" id="sticky-bar" aria-hidden="true">
<div class="sticky-bar__title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">L’Acció</a>
</div>
<nav class="sticky-bar__nav" aria-label="<?php esc_attr_e( 'Navegació ràpida', 'laccio' ); ?>">
<?php wp_nav_menu( laccio_nav_menu_args( false ) ); ?>
</nav>
</div>
<header class="site-header" role="banner">
<div class="masthead">
<?php if ( is_front_page() ) : ?>
<h1 class="masthead__title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">L’Acció</a>
</h1>
<?php else : ?>
<p class="masthead__title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">L’Acció</a>
</p>
<?php endif; ?>
<p class="masthead__subtitle">
<?php esc_html_e( "Revista digital d'ERC Terrassa · Hereva del diari L'Acció (1931)", 'laccio' ); ?>
</p>
<p class="masthead__date">
<?php
/* translators: %s: current month and year in Catalan, e.g. "Abril 2026" */
printf( esc_html__( 'Terrassa · %s', 'laccio' ), laccio_catalan_month_year() );
?>
</p>
</div><!-- .masthead -->
<nav class="site-nav" role="navigation" aria-label="<?php esc_attr_e( 'Menú principal', 'laccio' ); ?>">
<div class="nav-inner">
<button
class="theme-toggle"
id="theme-toggle"
aria-label="<?php esc_attr_e( 'Canvia el tema de color', 'laccio' ); ?>"
title="<?php esc_attr_e( 'Canvia entre mode clar i fosc', 'laccio' ); ?>"
></button>
<div class="nav-links" id="nav-links">
<?php wp_nav_menu( laccio_nav_menu_args() ); ?>
</div><!-- #nav-links -->
</div><!-- .nav-inner -->
</nav><!-- .site-nav -->
<?php
// News ticker: show only on front page
if ( is_front_page() ) {
$ticker_posts = laccio_get_ticker_posts( 3 );
if ( ! empty( $ticker_posts ) ) :
// Build items — duplicated for seamless mobile scroll
$items_html = '';
foreach ( $ticker_posts as $tp ) {
$items_html .= sprintf(
'<span class="news-ticker__item"><a href="%s">%s</a></span><span class="news-ticker__sep" aria-hidden="true">·</span>',
esc_url( get_permalink( $tp->ID ) ),
esc_html( get_the_title( $tp->ID ) )
);
}
?>
<div class="news-ticker" role="marquee" aria-live="off" aria-label="<?php esc_attr_e( 'Darreres notícies', 'laccio' ); ?>">
<div class="news-ticker__inner">
<span class="news-ticker__label" aria-hidden="true"><?php esc_html_e( 'Últim', 'laccio' ); ?></span>
<div class="news-ticker__track" id="ticker-track">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $items_html . $items_html; // duplicate for seamless loop
?>
</div>
</div>
</div>
<?php endif;
}
?>
</header><!-- .site-header -->
<main id="main-content" class="site-main">