feat: show WordPress posts

This commit is contained in:
2025-09-17 22:30:09 +04:00
parent 63f947fefc
commit 57e0a0d35f
8 changed files with 556 additions and 10 deletions
+75 -5
View File
@@ -24,6 +24,9 @@ setSecurityHeaders();
<link rel="stylesheet" href="css/styles.css?v=<?php echo filemtime('css/styles.css'); ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css">
<link rel="stylesheet" href="css/mastodon-timeline.min.css?v=<?php echo filemtime('css/mastodon-timeline.min.css'); ?>">
<?php if (defined('WORDPRESS_ENABLED') && WORDPRESS_ENABLED): ?>
<link rel="stylesheet" href="css/wordpress-posts.css?v=<?php echo filemtime('css/wordpress-posts.css'); ?>">
<?php endif; ?>
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
@@ -151,13 +154,79 @@ setSecurityHeaders();
?>
</section>
<div id="mt-container" class="mt-container">
<div class="mt-header">
<h2 class="mt-title">Fil d'actualités <i class="fab fa-mastodon"></i></h2>
<!-- Container pour Mastodon et WordPress côte à côte -->
<div class="timeline-wordpress-container">
<div id="mt-container" class="mt-container">
<div class="mt-header">
<h2 class="mt-title">Fil d'actualités <i class="fab fa-mastodon"></i></h2>
</div>
<div class="mt-body" role="feed">
<div class="mt-loading-spinner"></div>
</div>
</div>
<div class="mt-body" role="feed">
<div class="mt-loading-spinner"></div>
<!-- Section Articles WordPress (desktop à droite, mobile en dessous) -->
<?php if (defined('WORDPRESS_ENABLED') && WORDPRESS_ENABLED && !empty(WORDPRESS_URL)): ?>
<div class="wordpress-section">
<div class="wordpress-container">
<div class="wordpress-header">
<i class="fas fa-newspaper"></i>
Articles <?php if (!empty(WORDPRESS_URL)): ?>
<a href="<?php echo htmlspecialchars(WORDPRESS_URL); ?>"
target="_blank"
rel="noopener noreferrer"
title="Visiter <?php echo htmlspecialchars(parse_url(WORDPRESS_URL, PHP_URL_HOST)); ?>">
<?php echo htmlspecialchars(parse_url(WORDPRESS_URL, PHP_URL_HOST)); ?>
</a>
<?php endif; ?>
</div>
<div class="wordpress-posts-list">
<?php
$wordpressPosts = getWordPressPosts();
if (empty($wordpressPosts)) {
echo '<div class="wordpress-no-posts">Aucun article disponible</div>';
} else {
foreach ($wordpressPosts as $post):
?>
<a href="<?php echo htmlspecialchars($post['link']); ?>"
class="wordpress-post-item"
target="_blank"
rel="noopener noreferrer"
title="<?php echo htmlspecialchars($post['title']); ?>">
<div class="wordpress-post-thumb">
<?php if (!empty($post['featured_image'])): ?>
<img src="<?php echo htmlspecialchars($post['featured_image']); ?>"
alt="<?php echo htmlspecialchars($post['title']); ?>"
loading="lazy">
<?php else: ?>
<i class="fas fa-file-alt"></i>
<?php endif; ?>
</div>
<div class="wordpress-post-info">
<h3 class="wordpress-post-title">
<?php echo htmlspecialchars($post['title']); ?>
</h3>
<div class="wordpress-post-meta">
<span><?php echo htmlspecialchars($post['date']); ?></span>
<?php if (!empty($post['author'])): ?>
<span>•</span>
<span><?php echo htmlspecialchars($post['author']); ?></span>
<?php endif; ?>
</div>
</div>
</a>
<?php
endforeach;
}
?>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
@@ -179,6 +248,7 @@ setSecurityHeaders();
<!-- Séparateur stylisé -->
<hr class="section-divider">
<!-- Section Shorts -->
<section class="video-section" aria-labelledby="shorts-heading">
<div class="section-header">