Compare commits
5 Commits
d359aa43d8
...
6010de5476
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6010de5476 | ||
|
|
402f5e3350 | ||
|
|
5b9dbed556 | ||
|
|
68a0c9f522 | ||
|
|
d2f8980b43 |
|
|
@ -53,3 +53,103 @@ function dynamiques_disable_mime_check($data, $file, $filename, $mimes)
|
|||
return $data;
|
||||
}
|
||||
add_filter('wp_check_filetype_and_ext', 'dynamiques_disable_mime_check', 10, 4);
|
||||
|
||||
|
||||
/** ------------------------------
|
||||
LOGO ALTERNATIF CUSTOMIZER
|
||||
------------------------------*/
|
||||
|
||||
/**
|
||||
* Ajouter l'option de logo alternatif dans le customizer
|
||||
* (Le logo principal est géré nativement par WordPress dans "Identité du site")
|
||||
*/
|
||||
function dynamiques_customize_register($wp_customize)
|
||||
{
|
||||
// Ajouter le logo alternatif dans la section "Identité du site" existante
|
||||
$wp_customize->add_setting('dynamiques_logo_secondary', array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
'transport' => 'refresh',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'dynamiques_logo_secondary', array(
|
||||
'label' => __('Logo alternatif (Au survol)', 'dynamiques'),
|
||||
'section' => 'title_tagline', // Section native "Identité du site"
|
||||
'settings' => 'dynamiques_logo_secondary',
|
||||
'description' => __('Logo alternatif utilisé au survol du logo principal', 'dynamiques'),
|
||||
'priority' => 9, // Juste après le logo principal
|
||||
)));
|
||||
}
|
||||
add_action('customize_register', 'dynamiques_customize_register');
|
||||
|
||||
|
||||
/** ------------------------------
|
||||
LOGO SECONDAIRE UTILITIES
|
||||
------------------------------*/
|
||||
|
||||
/**
|
||||
* Récupérer l'URL du logo secondaire
|
||||
* @return string|false L'URL du logo secondaire ou false si non configuré
|
||||
*/
|
||||
function get_secondary_logo_url()
|
||||
{
|
||||
return get_theme_mod('dynamiques_logo_secondary', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupérer le HTML complet du logo secondaire
|
||||
* @param string $size Taille de l'image (par défaut 'full')
|
||||
* @param array $attr Attributs HTML supplémentaires
|
||||
* @return string|false Le HTML du logo ou false si non configuré
|
||||
*/
|
||||
function get_secondary_logo($size = 'full', $attr = array())
|
||||
{
|
||||
$secondary_logo_url = get_secondary_logo_url();
|
||||
|
||||
if (!$secondary_logo_url) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Attributs par défaut
|
||||
$default_attr = array(
|
||||
'alt' => get_bloginfo('name') . ' - Logo alternatif',
|
||||
'class' => 'secondary-logo'
|
||||
);
|
||||
|
||||
// Fusionner avec les attributs personnalisés
|
||||
$attr = array_merge($default_attr, $attr);
|
||||
|
||||
// Essayer de récupérer l'ID de l'attachement
|
||||
$secondary_logo_id = attachment_url_to_postid($secondary_logo_url);
|
||||
|
||||
if ($secondary_logo_id) {
|
||||
// Utiliser wp_get_attachment_image si on a l'ID
|
||||
return wp_get_attachment_image($secondary_logo_id, $size, false, $attr);
|
||||
} else {
|
||||
// Fallback : créer la balise img manuellement
|
||||
$attr_string = '';
|
||||
foreach ($attr as $key => $value) {
|
||||
$attr_string .= ' ' . $key . '="' . esc_attr($value) . '"';
|
||||
}
|
||||
return '<img src="' . esc_url($secondary_logo_url) . '"' . $attr_string . '>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Afficher le logo secondaire directement
|
||||
* @param string $size Taille de l'image
|
||||
* @param array $attr Attributs HTML supplémentaires
|
||||
*/
|
||||
function the_secondary_logo($size = 'full', $attr = array())
|
||||
{
|
||||
echo get_secondary_logo($size, $attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifier si un logo secondaire est configuré
|
||||
* @return bool
|
||||
*/
|
||||
function has_secondary_logo()
|
||||
{
|
||||
return !empty(get_secondary_logo_url());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
@apply flex gap-8 flex-wrap;
|
||||
|
||||
&__tag {
|
||||
@apply text-lg font-normal border border-primary p-4 h-fit flex items-center gap-2;
|
||||
@apply text-xl font-normal border border-primary p-4 h-fit flex items-center gap-2;
|
||||
svg {
|
||||
transition: transform 0.3s ease-in-out;
|
||||
@apply w-8 h-8;
|
||||
|
|
|
|||
|
|
@ -10,22 +10,32 @@
|
|||
<span><?php echo __('Rechercher', 'homegrade-theme__texte-fonctionnel') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$lastRevue = $recent_posts = wp_get_recent_posts(array(
|
||||
'numberposts' => 1,
|
||||
'post_type' => 'revues',
|
||||
'post_status' => 'publish',
|
||||
));
|
||||
$lastRevueUrl = get_permalink($lastRevue[0]['ID']);
|
||||
?>
|
||||
<ul class="search-module__suggestions">
|
||||
<?php if ($lastRevue) : ?>
|
||||
<li class="suggestion-item">
|
||||
<a href="<?php echo $lastRevueUrl; ?>">Lire la dernière revue </a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<li class="suggestion-item">
|
||||
<a href="#">Lire la dernière revue </a>
|
||||
<a href="<?php echo home_url('/contact'); ?>">Contacter le CARHOP </a>
|
||||
</li>
|
||||
<li class="suggestion-item">
|
||||
<a href="#">Contacter le CARHOP </a>
|
||||
<a href="<?php echo home_url('/a-propos'); ?>">Faire connaissance avec l’équipe de Dynamiques</a>
|
||||
</li>
|
||||
<li class="suggestion-item">
|
||||
<a href="#">Faire connaissance avec l’équipe de Dynamiques</a>
|
||||
<a href="<?php echo home_url('/articles'); ?>">Découvrir les thématiques abordées</a>
|
||||
</li>
|
||||
<li class="suggestion-item">
|
||||
<a href="#">Découvrir les thématiques abordées</a>
|
||||
</li>
|
||||
<li class="suggestion-item">
|
||||
<a href="#">Je souhaite proposer un article</a>
|
||||
<a href="<?php echo get_the_permalink(32); ?>">Je souhaite proposer un article</a>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
|
|
@ -68,12 +68,7 @@ $articlesAmount = get_author_articles_amount($author_id);
|
|||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -104,8 +99,8 @@ $articlesAmount = get_author_articles_amount($author_id);
|
|||
get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $latestArticle[0]->ID,
|
||||
'showCover' => true,
|
||||
|
||||
));
|
||||
|
||||
?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
|
|
@ -2,9 +2,16 @@
|
|||
?>
|
||||
<div class="primary-menu-container lg:flex lg:justify-between lg:items-center">
|
||||
<nav id="primary-menu-nav" class="flex justify-between items-center">
|
||||
<div class="website_logo">
|
||||
<?php $secondary_logo_url = get_secondary_logo_url(); ?>
|
||||
<div class="website_logo <?php echo $secondary_logo_url ? 'has-secondary-logo' : ''; ?>">
|
||||
<?php if (has_custom_logo()) { ?>
|
||||
|
||||
<?php the_custom_logo(); ?>
|
||||
|
||||
<?php if ($secondary_logo_url) : ?>
|
||||
<img id="secondary-logo" src="<?php echo $secondary_logo_url; ?>" alt="<?php echo get_bloginfo('name'); ?> - Logo alternatif">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php } else { ?>
|
||||
<a href=" <?php echo get_bloginfo('url'); ?>" class="font-extrabold text-lg uppercase">
|
||||
<?php echo get_bloginfo('name'); ?>
|
||||
|
|
@ -19,15 +26,10 @@
|
|||
|
||||
|
||||
<div id="primary-menu">
|
||||
<!-- <button id="close-menu-btn" aria-label="<?php echo esc_html_e("Fermer le menu", 'deligraph-theme') ?>">
|
||||
<?php echo get_template_part('resources/svg/close-menu-icon.svg'); ?>
|
||||
</button> -->
|
||||
<?php
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'container' => 'false',
|
||||
// 'container_id' => 'primary-menu',
|
||||
// 'container_class' => '',
|
||||
'theme_location' => 'primary',
|
||||
'li_class' => 'menu-navlink',
|
||||
'fallback_cb' => false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user