Compare commits

...

2 Commits

Author SHA1 Message Date
Antoine M
7f014b07de FEEDBACK Removint the swiper pagination fraction
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-24 16:20:03 +02:00
Antoine M
0e16078554 FEATURE Introducing social networks block 2025-09-24 16:19:31 +02:00
9 changed files with 82 additions and 36 deletions

View File

@ -0,0 +1,21 @@
{
"name": "acf/social-networks",
"title": "Réseaux sociaux",
"category": "carhop-blocks",
"multiple": false,
"icon": {
"foreground": "#136f63",
"src": "groups"
},
"keywords": [
"réseaux sociaux",
"facebook",
"youtube"
],
"supports": {},
"acf": {
"mode": "auto",
"renderTemplate": "social-networks.php"
},
"align": "full"
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Bloc ACF pour l'affichage des réseaux sociaux
* Utilise les options du thème directement
*/
// Récupérer les options directement depuis la base de données
$options = get_option('dynamiques_options');
$facebook = isset($options['facebook_url']) ? $options['facebook_url'] : '';
$youtube = isset($options['youtube_url']) ? $options['youtube_url'] : '';
// Afficher les liens sociaux si au moins un est configuré
if (!empty($facebook) || !empty($youtube)) :
?>
<ul class="social-networks-links">
<?php if (!empty($facebook)) : ?>
<li>
<a class="social-link" title="Facebook" href="<?php echo esc_url($facebook); ?>" target="_blank" rel="noopener noreferrer">
<img class="social-icon" src="<?php echo get_template_directory_uri() . '/resources/img/icons/carhop-social-facebook.svg'; ?>" alt="Facebook">
</a>
</li>
<?php endif; ?>
<?php if (!empty($youtube)) : ?>
<li>
<a class="social-link" title="YouTube" href="<?php echo esc_url($youtube); ?>" target="_blank" rel="noopener noreferrer">
<img class="social-icon" src="<?php echo get_template_directory_uri() . '/resources/img/icons/carhop-social-youtube.svg'; ?>" alt="YouTube">
</a>
</li>
<?php endif; ?>
</ul>
<?php else : ?>
<div class="social-networks-empty">
<p><em>Aucun réseau social configuré. Allez dans Réglages > Réseaux sociaux pour les configurer.</em></p>
</div>
<?php endif;

View File

@ -54,6 +54,7 @@ function carhop_register_blocks()
register_block_type(__DIR__ . '/acf-blocks/gallery');
register_block_type(__DIR__ . '/acf-blocks/social-networks');
// Enregistrer le script pour le bloc gallery
wp_register_script(

View File

@ -72,7 +72,7 @@ $query = new WP_Query(array(
<?php endwhile; ?>
</div>
<div class="swiper-pagination-fraction"></div>
<!-- <div class="swiper-pagination-fraction"></div> -->
<div class="swiper-pagination"></div>
<div class="swiper-controls">

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'a395e28275eb747267a2');
<?php return array('dependencies' => array(), 'version' => '403fadf2194f8fc35f59');

View File

@ -8,8 +8,6 @@ document.addEventListener("DOMContentLoaded", function () {
const swiperFraction = currentBlock.querySelector(".swiper-pagination-fraction");
const slides = currentBlock.querySelectorAll(".swiper-slide");
const slideCount = slides.length;
swiperFraction.textContent = `Article n°1 sur ${slideCount}`;
console.log(slideCount);
new Swiper(".revues-precedentes-swiper", {
slidesPerView: 1,
spaceBetween: 30,
@ -38,20 +36,16 @@ document.addEventListener("DOMContentLoaded", function () {
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev"
},
pagination: {
el: ".swiper-pagination",
clickable: true,
renderBullet: function (index, className) {
return `<button class="${className}"></button>`;
}
},
on: {
slideChange: swiper => {
const slidesCount = swiper?.slides?.length;
swiperFraction.textContent = `Revue n°${swiper.realIndex + 1} sur ${slidesCount}`;
}
}
// on: {
// slideChange: (swiper) => {
// const slidesCount = swiper?.slides?.length;
// swiperFraction.textContent = `Revue n°${
// swiper.realIndex + 1
// } sur ${slidesCount}`;
// },
// },
});
});
/******/ })()

View File

@ -1 +1 @@
{"version":3,"file":"revues-precedentes/view.js","mappings":";;;;AAAAA,QAAQ,CAACC,gBAAgB,CAAC,kBAAkB,EAAE,YAAY;EACzD,MAAMC,YAAY,GAAGF,QAAQ,CAACG,aAAa,CAAC,2BAA2B,CAAC;EACxE,IAAI,CAACD,YAAY,EAAE;EAEnB,MAAME,cAAc,GAAGF,YAAY,CAACC,aAAa,CAChD,6BACD,CAAC;EAED,MAAME,MAAM,GAAGH,YAAY,CAACI,gBAAgB,CAAC,eAAe,CAAC;EAC7D,MAAMC,UAAU,GAAGF,MAAM,CAACG,MAAM;EAChCJ,cAAc,CAACK,WAAW,GAAG,mBAAmBF,UAAU,EAAE;EAC5DG,OAAO,CAACC,GAAG,CAACJ,UAAU,CAAC;EACvB,IAAIK,MAAM,CAAC,4BAA4B,EAAE;IACxCC,aAAa,EAAE,CAAC;IAChBC,YAAY,EAAE,EAAE;IAChBC,IAAI,EAAE,IAAI;IACVC,UAAU,EAAE,IAAI;IAChBC,UAAU,EAAE;MACXC,EAAE,EAAE,oBAAoB;MACxBC,SAAS,EAAE;IACZ,CAAC;IACDC,UAAU,EAAE;MACXC,OAAO,EAAE,IAAI;MACbC,WAAW,EAAE,IAAI;MAAE;MACnBC,WAAW,EAAE,CAAC;MAAE;MAChBC,cAAc,EAAE,KAAK,CAAE;IACxB,CAAC;IACDC,QAAQ,EAAE;MACTJ,OAAO,EAAE,IAAI;MACbK,cAAc,EAAE;IACjB,CAAC;IACD;IACA;IACA;IACA;IACAC,UAAU,EAAE;MACXC,MAAM,EAAE,qBAAqB;MAC7BC,MAAM,EAAE;IACT,CAAC;IACDZ,UAAU,EAAE;MACXC,EAAE,EAAE,oBAAoB;MACxBC,SAAS,EAAE,IAAI;MACfW,YAAY,EAAE,SAAAA,CAAUC,KAAK,EAAEC,SAAS,EAAE;QACzC,OAAO,kBAAkBA,SAAS,aAAa;MAChD;IACD,CAAC;IACDC,EAAE,EAAE;MACHC,WAAW,EAAGC,MAAM,IAAK;QACxB,MAAMC,WAAW,GAAGD,MAAM,EAAE9B,MAAM,EAAEG,MAAM;QAC1CJ,cAAc,CAACK,WAAW,GAAG,WAC5B0B,MAAM,CAACE,SAAS,GAAG,CAAC,QACbD,WAAW,EAAE;MACtB;IACD;EACD,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://revues-precedentes/./src/revues-precedentes/view.js"],"sourcesContent":["document.addEventListener(\"DOMContentLoaded\", function () {\n\tconst currentBlock = document.querySelector(\".block-revues-precedentes\");\n\tif (!currentBlock) return;\n\n\tconst swiperFraction = currentBlock.querySelector(\n\t\t\".swiper-pagination-fraction\",\n\t);\n\n\tconst slides = currentBlock.querySelectorAll(\".swiper-slide\");\n\tconst slideCount = slides.length;\n\tswiperFraction.textContent = `Article n°1 sur ${slideCount}`;\n\tconsole.log(slideCount);\n\tnew Swiper(\".revues-precedentes-swiper\", {\n\t\tslidesPerView: 1,\n\t\tspaceBetween: 30,\n\t\tloop: true,\n\t\tgrabCursor: true,\n\t\tpagination: {\n\t\t\tel: \".swiper-pagination\",\n\t\t\tclickable: true,\n\t\t},\n\t\tmousewheel: {\n\t\t\tenabled: true,\n\t\t\tforceToAxis: true, // Force le scroll dans l'axe du slider\n\t\t\tsensitivity: 1, // Sensibilité du scroll (1 = normal)\n\t\t\treleaseOnEdges: false, // Continue le scroll même aux bords\n\t\t},\n\t\tkeyboard: {\n\t\t\tenabled: true,\n\t\t\tonlyInViewport: true,\n\t\t},\n\t\t// Activation du swipe/glissement tactile\n\t\t// touchEventsTarget: \"container\",\n\t\t// simulateTouch: true,\n\t\t// allowTouchMove: true,\n\t\tnavigation: {\n\t\t\tnextEl: \".swiper-button-next\",\n\t\t\tprevEl: \".swiper-button-prev\",\n\t\t},\n\t\tpagination: {\n\t\t\tel: \".swiper-pagination\",\n\t\t\tclickable: true,\n\t\t\trenderBullet: function (index, className) {\n\t\t\t\treturn `<button class=\"${className}\"></button>`;\n\t\t\t},\n\t\t},\n\t\ton: {\n\t\t\tslideChange: (swiper) => {\n\t\t\t\tconst slidesCount = swiper?.slides?.length;\n\t\t\t\tswiperFraction.textContent = `Revue n°${\n\t\t\t\t\tswiper.realIndex + 1\n\t\t\t\t} sur ${slidesCount}`;\n\t\t\t},\n\t\t},\n\t});\n});\n"],"names":["document","addEventListener","currentBlock","querySelector","swiperFraction","slides","querySelectorAll","slideCount","length","textContent","console","log","Swiper","slidesPerView","spaceBetween","loop","grabCursor","pagination","el","clickable","mousewheel","enabled","forceToAxis","sensitivity","releaseOnEdges","keyboard","onlyInViewport","navigation","nextEl","prevEl","renderBullet","index","className","on","slideChange","swiper","slidesCount","realIndex"],"sourceRoot":""}
{"version":3,"file":"revues-precedentes/view.js","mappings":";;;;AAAAA,QAAQ,CAACC,gBAAgB,CAAC,kBAAkB,EAAE,YAAY;EACzD,MAAMC,YAAY,GAAGF,QAAQ,CAACG,aAAa,CAAC,2BAA2B,CAAC;EACxE,IAAI,CAACD,YAAY,EAAE;EAEnB,MAAME,cAAc,GAAGF,YAAY,CAACC,aAAa,CAChD,6BACD,CAAC;EAED,MAAME,MAAM,GAAGH,YAAY,CAACI,gBAAgB,CAAC,eAAe,CAAC;EAC7D,MAAMC,UAAU,GAAGF,MAAM,CAACG,MAAM;EAEhC,IAAIC,MAAM,CAAC,4BAA4B,EAAE;IACxCC,aAAa,EAAE,CAAC;IAChBC,YAAY,EAAE,EAAE;IAChBC,IAAI,EAAE,IAAI;IACVC,UAAU,EAAE,IAAI;IAChBC,UAAU,EAAE;MACXC,EAAE,EAAE,oBAAoB;MACxBC,SAAS,EAAE;IACZ,CAAC;IACDC,UAAU,EAAE;MACXC,OAAO,EAAE,IAAI;MACbC,WAAW,EAAE,IAAI;MAAE;MACnBC,WAAW,EAAE,CAAC;MAAE;MAChBC,cAAc,EAAE,KAAK,CAAE;IACxB,CAAC;IACDC,QAAQ,EAAE;MACTJ,OAAO,EAAE,IAAI;MACbK,cAAc,EAAE;IACjB,CAAC;IACD;IACA;IACA;IACA;IACAC,UAAU,EAAE;MACXC,MAAM,EAAE,qBAAqB;MAC7BC,MAAM,EAAE;IACT;;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;EACD,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://revues-precedentes/./src/revues-precedentes/view.js"],"sourcesContent":["document.addEventListener(\"DOMContentLoaded\", function () {\n\tconst currentBlock = document.querySelector(\".block-revues-precedentes\");\n\tif (!currentBlock) return;\n\n\tconst swiperFraction = currentBlock.querySelector(\n\t\t\".swiper-pagination-fraction\",\n\t);\n\n\tconst slides = currentBlock.querySelectorAll(\".swiper-slide\");\n\tconst slideCount = slides.length;\n\n\tnew Swiper(\".revues-precedentes-swiper\", {\n\t\tslidesPerView: 1,\n\t\tspaceBetween: 30,\n\t\tloop: true,\n\t\tgrabCursor: true,\n\t\tpagination: {\n\t\t\tel: \".swiper-pagination\",\n\t\t\tclickable: true,\n\t\t},\n\t\tmousewheel: {\n\t\t\tenabled: true,\n\t\t\tforceToAxis: true, // Force le scroll dans l'axe du slider\n\t\t\tsensitivity: 1, // Sensibilité du scroll (1 = normal)\n\t\t\treleaseOnEdges: false, // Continue le scroll même aux bords\n\t\t},\n\t\tkeyboard: {\n\t\t\tenabled: true,\n\t\t\tonlyInViewport: true,\n\t\t},\n\t\t// Activation du swipe/glissement tactile\n\t\t// touchEventsTarget: \"container\",\n\t\t// simulateTouch: true,\n\t\t// allowTouchMove: true,\n\t\tnavigation: {\n\t\t\tnextEl: \".swiper-button-next\",\n\t\t\tprevEl: \".swiper-button-prev\",\n\t\t},\n\n\t\t// on: {\n\t\t// \tslideChange: (swiper) => {\n\t\t// \t\tconst slidesCount = swiper?.slides?.length;\n\t\t// \t\tswiperFraction.textContent = `Revue n°${\n\t\t// \t\t\tswiper.realIndex + 1\n\t\t// \t\t} sur ${slidesCount}`;\n\t\t// \t},\n\t\t// },\n\t});\n});\n"],"names":["document","addEventListener","currentBlock","querySelector","swiperFraction","slides","querySelectorAll","slideCount","length","Swiper","slidesPerView","spaceBetween","loop","grabCursor","pagination","el","clickable","mousewheel","enabled","forceToAxis","sensitivity","releaseOnEdges","keyboard","onlyInViewport","navigation","nextEl","prevEl"],"sourceRoot":""}

View File

@ -72,7 +72,7 @@ $query = new WP_Query(array(
<?php endwhile; ?>
</div>
<div class="swiper-pagination-fraction"></div>
<!-- <div class="swiper-pagination-fraction"></div> -->
<div class="swiper-pagination"></div>
<div class="swiper-controls">

View File

@ -8,8 +8,7 @@ document.addEventListener("DOMContentLoaded", function () {
const slides = currentBlock.querySelectorAll(".swiper-slide");
const slideCount = slides.length;
swiperFraction.textContent = `Article n°1 sur ${slideCount}`;
console.log(slideCount);
new Swiper(".revues-precedentes-swiper", {
slidesPerView: 1,
spaceBetween: 30,
@ -37,20 +36,14 @@ document.addEventListener("DOMContentLoaded", function () {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
renderBullet: function (index, className) {
return `<button class="${className}"></button>`;
},
},
on: {
slideChange: (swiper) => {
const slidesCount = swiper?.slides?.length;
swiperFraction.textContent = `Revue n°${
swiper.realIndex + 1
} sur ${slidesCount}`;
},
},
// on: {
// slideChange: (swiper) => {
// const slidesCount = swiper?.slides?.length;
// swiperFraction.textContent = `Revue n°${
// swiper.realIndex + 1
// } sur ${slidesCount}`;
// },
// },
});
});