Compare commits
7 Commits
bb842dedc4
...
92084f7826
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92084f7826 | ||
|
|
a6045b8bbb | ||
|
|
7b9d16d5b3 | ||
|
|
9fde5d1409 | ||
|
|
87414f42df | ||
|
|
a53f5b6172 | ||
|
|
6d58909701 |
26
plugins/carhop-blocks/acf-blocks/gallery/block.json
Normal file
26
plugins/carhop-blocks/acf-blocks/gallery/block.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "acf/gallery",
|
||||
"title": "Galerie",
|
||||
"category": "carhop-blocks",
|
||||
"multiple": false,
|
||||
"icon": {
|
||||
"foreground": "#136f63",
|
||||
"src": "groups"
|
||||
},
|
||||
"keywords": [
|
||||
"galerie",
|
||||
"photos",
|
||||
"images"
|
||||
],
|
||||
"supports": {
|
||||
"align": [
|
||||
"full"
|
||||
]
|
||||
},
|
||||
"acf": {
|
||||
"mode": "auto",
|
||||
"renderTemplate": "gallery.php"
|
||||
},
|
||||
"viewScript": "file:./view.js",
|
||||
"align": "full"
|
||||
}
|
||||
42
plugins/carhop-blocks/acf-blocks/gallery/gallery.php
Normal file
42
plugins/carhop-blocks/acf-blocks/gallery/gallery.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
$gallery = get_field('gallery');
|
||||
|
||||
|
||||
// Charger le script JavaScript
|
||||
wp_enqueue_script('carhop-gallery-view');
|
||||
|
||||
?>
|
||||
|
||||
<section class="block-gallery gallery content-section">
|
||||
<div class="gallery__slider">
|
||||
<?php if ($gallery && is_array($gallery)) : ?>
|
||||
<div class="swiper gallery-swiper">
|
||||
<div class="swiper-wrapper">
|
||||
<?php foreach ($gallery as $image) : ?>
|
||||
<div class="swiper-slide">
|
||||
<div class="gallery-card">
|
||||
<div class="gallery-card__image">
|
||||
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="swiper-pagination-fraction"></div>
|
||||
<div class="swiper-pagination"></div>
|
||||
|
||||
<div class="swiper-controls">
|
||||
<div class="swiper-button-prev"></div>
|
||||
<div class="swiper-button-next"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
36
plugins/carhop-blocks/acf-blocks/gallery/view.js
Normal file
36
plugins/carhop-blocks/acf-blocks/gallery/view.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const galleries = document.querySelectorAll(".block-gallery");
|
||||
if (!galleries) return;
|
||||
|
||||
const currentBlock = document.querySelector(".block-gallery");
|
||||
if (!currentBlock) return;
|
||||
|
||||
const swiperFraction = currentBlock.querySelector(".swiper-pagination-fraction");
|
||||
const slides = currentBlock.querySelectorAll(".swiper-slide");
|
||||
const slideCount = slides.length;
|
||||
swiperFraction.textContent = `Article n°1 sur ${slideCount}`;
|
||||
|
||||
new Swiper(".gallery-swiper", {
|
||||
slidesPerView: 2,
|
||||
spaceBetween: 30,
|
||||
loop: true,
|
||||
grabCursor: true,
|
||||
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 = `Photo n°${swiper.realIndex + 1} sur ${slidesCount}`;
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "deliblocks",
|
||||
"textdomain": "carhop-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-primitives'), 'version' => '4d7a8310574bcf753578');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-primitives'), 'version' => '4148e87939fccf7f9ff3');
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ const trash = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx
|
|||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/chapter-section","version":"0.1.0","title":" Section Chapitre","category":"carhop-blocks","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false},"textdomain":"deliblocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","render":"file:./render.php","attributes":{"align":{"type":"string","default":"full"},"coverUrl":{"type":"string"},"coverAlt":{"type":"string"},"coverId":{"type":"number"},"coverSize":{"type":"string","default":"large","enum":["small","medium","grande","large"]},"disposition":{"type":"string","default":"left","enum":["left","right"]},"hasBackgroundColor":{"type":"boolean","default":false},"backgroundColor":{"type":"string","default":"#ffffff"},"backgroundOrientation":{"type":"string","default":"left","enum":["left","right"]}},"usesContext":["postType","postId"]}');
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/chapter-section","version":"0.1.0","title":" Section Chapitre","category":"carhop-blocks","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false},"textdomain":"carhop-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","render":"file:./render.php","attributes":{"align":{"type":"string","default":"full"},"coverUrl":{"type":"string"},"coverAlt":{"type":"string"},"coverId":{"type":"number"},"coverSize":{"type":"string","default":"large","enum":["small","medium","grande","large"]},"disposition":{"type":"string","default":"left","enum":["left","right"]},"hasBackgroundColor":{"type":"boolean","default":false},"backgroundColor":{"type":"string","default":"#ffffff"},"backgroundOrientation":{"type":"string","default":"left","enum":["left","right"]}},"usesContext":["postType","postId"]}');
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
|
@ -238,16 +238,16 @@ function Edit({
|
|||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
|
||||
className: "chapter-section__innerblocks",
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks, {
|
||||
template: [["core/heading", {
|
||||
className: "chapter-section__title",
|
||||
placeholder: "Chapter Title",
|
||||
content: "Un titre précis "
|
||||
template: [["carhop-blocks/heading", {
|
||||
innerBlocks: [["core/heading", {
|
||||
content: "Un titre précis "
|
||||
}]]
|
||||
}], ["core/paragraph", {
|
||||
className: "chapter-section__title",
|
||||
placeholder: "Chapter Title",
|
||||
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse augue augue, sagittis quis mauris in, consequat vehicula est. Aliquam quis nulla ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras bibendum eget lorem eget aliquet. Fusce vel consequat neque. "
|
||||
}]],
|
||||
allowedBlocks: ["core/heading", "core/paragraph", "core/list", "core/button", "core/buttons", "carhop-blocks/cta"]
|
||||
allowedBlocks: ["core/heading", "core/paragraph", "core/list", "core/button", "core/buttons", "carhop-blocks/cta", "carhop-blocks/heading"]
|
||||
})
|
||||
})
|
||||
}), coverUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -180,11 +180,16 @@ export default function Edit({ attributes, setAttributes, ...props }) {
|
|||
<InnerBlocks
|
||||
template={[
|
||||
[
|
||||
"core/heading",
|
||||
"carhop-blocks/heading",
|
||||
{
|
||||
className: "chapter-section__title",
|
||||
placeholder: "Chapter Title",
|
||||
content: "Un titre précis ",
|
||||
innerBlocks: [
|
||||
[
|
||||
"core/heading",
|
||||
{
|
||||
content: "Un titre précis ",
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
|
|
@ -204,6 +209,7 @@ export default function Edit({ attributes, setAttributes, ...props }) {
|
|||
"core/button",
|
||||
"core/buttons",
|
||||
"carhop-blocks/cta",
|
||||
"carhop-blocks/heading",
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,18 @@ function carhop_register_blocks()
|
|||
register_block_type(__DIR__ . '/blocks/decorative-shapes/build');
|
||||
register_block_type(__DIR__ . '/blocks/narrative-card/build');
|
||||
register_block_type(__DIR__ . '/blocks/scroll-story-block/build');
|
||||
|
||||
|
||||
register_block_type(__DIR__ . '/acf-blocks/gallery');
|
||||
|
||||
// Enregistrer le script pour le bloc gallery
|
||||
wp_register_script(
|
||||
'carhop-gallery-view',
|
||||
plugins_url('acf-blocks/gallery/view.js', __FILE__),
|
||||
array(),
|
||||
filemtime(__DIR__ . '/acf-blocks/gallery/view.js'),
|
||||
true
|
||||
);
|
||||
}
|
||||
add_action('init', 'carhop_register_blocks');
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ $authors = get_posts(array(
|
|||
<?php $comities_related_authors = get_posts(array(
|
||||
'post_type' => 'auteurs',
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'title',
|
||||
'meta_key' => 'last_name',
|
||||
'orderby' => 'meta_value',
|
||||
'order' => 'ASC',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
|
|
@ -52,8 +53,10 @@ $authors = get_posts(array(
|
|||
$author_description = get_field('description', $author->ID);
|
||||
$author_email = get_field('email', $author->ID);
|
||||
|
||||
$is_director = $author->ID === 476 ? true : false;
|
||||
|
||||
?>
|
||||
<li class="comity-type__item author-card ">
|
||||
<li class="comity-type__item author-card <?php echo $is_director ? 'author-card--director' : ''; ?>">
|
||||
<div class="author-card__profile-picture">
|
||||
<?php if ($author_thumbnail) : ?>
|
||||
<img src="<?php echo $author_thumbnail['url']; ?>" alt="<?php echo $author_thumbnail['alt']; ?>">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user