diff --git a/plugins/carhop-blocks/src/press-ressources/block.json b/plugins/carhop-blocks/src/press-ressources/block.json new file mode 100644 index 0000000..874afc7 --- /dev/null +++ b/plugins/carhop-blocks/src/press-ressources/block.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "carhop-blocks/press-ressources", + "version": "0.1.0", + "title": "Ressources pour la presse", + "category": "carhop-blocks", + "icon": "smiley", + "description": "Ressources pour la presse", + "example": {}, + "supports": { + "html": false + }, + "textdomain": "carhop-blocks", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "render": "file:./render.php", + "viewScript": "file:./view.js" +} \ No newline at end of file diff --git a/plugins/carhop-blocks/src/press-ressources/edit.js b/plugins/carhop-blocks/src/press-ressources/edit.js new file mode 100644 index 0000000..dfe4fc2 --- /dev/null +++ b/plugins/carhop-blocks/src/press-ressources/edit.js @@ -0,0 +1,12 @@ +import { __ } from "@wordpress/i18n"; +import { useBlockProps } from "@wordpress/block-editor"; +import "./editor.scss"; +import ServerSideRender from "@wordpress/server-side-render"; + +export default function Edit() { + return ( +
+ +
+ ); +} diff --git a/plugins/carhop-blocks/src/press-ressources/editor.scss b/plugins/carhop-blocks/src/press-ressources/editor.scss new file mode 100644 index 0000000..42e1d80 --- /dev/null +++ b/plugins/carhop-blocks/src/press-ressources/editor.scss @@ -0,0 +1,9 @@ +/** + * The following styles get applied inside the editor only. + * + * Replace them with your own styles or remove the file completely. + */ + +.wp-block-create-block-chapo { + border: 1px dotted #f00; +} diff --git a/plugins/carhop-blocks/src/press-ressources/index.js b/plugins/carhop-blocks/src/press-ressources/index.js new file mode 100644 index 0000000..b8eebca --- /dev/null +++ b/plugins/carhop-blocks/src/press-ressources/index.js @@ -0,0 +1,16 @@ +import { registerBlockType } from "@wordpress/blocks"; +import "./style.scss"; + +import Edit from "./edit"; +import metadata from "./block.json"; + +registerBlockType(metadata.name, { + icon: { + src: ( + + + + ), + }, + edit: Edit, +}); diff --git a/plugins/carhop-blocks/src/press-ressources/press-toolbar.php b/plugins/carhop-blocks/src/press-ressources/press-toolbar.php new file mode 100644 index 0000000..e69de29 diff --git a/plugins/carhop-blocks/src/press-ressources/render.php b/plugins/carhop-blocks/src/press-ressources/render.php new file mode 100644 index 0000000..f3f20e3 --- /dev/null +++ b/plugins/carhop-blocks/src/press-ressources/render.php @@ -0,0 +1,147 @@ + 'press-ressources alignwide']); + + $contact_persons = get_field('contact_persons', 'option'); + $ressources_graphiques = get_field('ressources_graphiques', 'option'); + + ?> + +
> +
+
+ +
    + + $person->ID)); ?> + +
+
+
+ +
+
+ + + + + + + +
+
+
+
+ 'communique-presse', + 'posts_per_page' => 10, + )); + ?> +

Nos Communiqués de presse

+ + +
+ + +
+

ID); ?>

+

ID); ?>

+ Voir le communiqué +
+ + +
+
+ +
+

Ressources

+ +
    +
  • +

    contact direct

    + info@carhop.be + +32 67 48 58 61 +
  • + +
  • +

    Adresse postale

    +

    Avenue de la Houssière, 80 +
    7090 Braine-le-Comte +

    +
  • + +
  • +

    Réseaux sociaux

    + +
  • +
+

Ressources graphiques

+ + + + + + +
+ Liste des fichiers disponibles au téléchargement, avec leur format et leur poids. +
+ +
+ +
+

+ post_content); + + wp_reset_postdata(); + $post = $original_post; + } + ?> +
+
+
\ No newline at end of file diff --git a/plugins/carhop-blocks/src/press-ressources/style.scss b/plugins/carhop-blocks/src/press-ressources/style.scss new file mode 100644 index 0000000..39c7cda --- /dev/null +++ b/plugins/carhop-blocks/src/press-ressources/style.scss @@ -0,0 +1,12 @@ +/** + * The following styles get applied both on the front of your site + * and in the editor. + * + * Replace them with your own styles or remove the file completely. + */ + +.wp-block-create-block-chapo { + background-color: #21759b; + color: #fff; + padding: 2px; +} diff --git a/plugins/carhop-blocks/src/press-ressources/view.js b/plugins/carhop-blocks/src/press-ressources/view.js new file mode 100644 index 0000000..ac37b58 --- /dev/null +++ b/plugins/carhop-blocks/src/press-ressources/view.js @@ -0,0 +1,29 @@ +document.addEventListener("DOMContentLoaded", function () { + const toolbar = document.querySelector("#press-toolbar"); + if (!toolbar) return; + const toolbarButtons = toolbar.querySelectorAll("button"); + const ressourcesGridContentWrapper = document.querySelector( + ".ressources-grid-content-wrapper" + ); + + function setActiveTab(currentButton) { + toolbarButtons.forEach((button) => { + button.setAttribute("aria-selected", "false"); + }); + + currentButton.setAttribute("aria-selected", "true"); + ressourcesGridContentWrapper.setAttribute( + "data-active-tab", + currentButton.getAttribute("data-tab") + ); + } + + function initToolbar() { + toolbarButtons.forEach((button) => { + button.addEventListener("click", function () { + setActiveTab(button); + }); + }); + } + initToolbar(); +});