Skip to content

Instantly share code, notes, and snippets.

View gregoirenoyelle's full-sized avatar

Grégoire Noyelle gregoirenoyelle

View GitHub Profile
<!DOCTYPE HTML>
<html>
<head>
<title>Ma page type</title>
<meta charset="utf-8">
</head>
<body>
<!-- commentaire dans le htlm -->
<p>Mon paragraphe <br />
<?php
//* Function déclarée dans le fichier markup.php
function genesis_parse_attr( $context, $attributes = array(), $args = array() ) {
$defaults = array(
'class' => sanitize_html_class( $context ),
);
$attributes = wp_parse_args( $attributes, $defaults );
@gregoirenoyelle
gregoirenoyelle / acf-bloc-membre-css-grid.css
Last active September 21, 2021 13:31
Création d'un bloc Gutenberg avec ACF 5.8
/*
la classe .grille-equipe est ajoutée dans la balise body avec l'extension
Custom Body Class
https://fr.wordpress.org/plugins/wp-custom-body-class/
*/
/* Suppression des speudo éléments :before et :after qui sont comptés dans la grille */
.grille-equipe .entry-content:before,
.grille-equipe .entry-content:after {
display: none;
@gregoirenoyelle
gregoirenoyelle / gutenberg-custom-color-block.php
Created September 13, 2021 13:36
Custom Color in Gutenberg Blocs
<?php
/**
* Gamme de couleur
*/
function gn_gamme_couleur() {
// Ensemble de la gamme
return array (
'black' => '#000000',
'dark-blue' => '#073559',
@gregoirenoyelle
gregoirenoyelle / gutenberg-innerblock-acf-affichage.php
Last active September 12, 2021 13:28
Ajouter des InnerBlock dans Gutenberg avec ACF
<?php
/**
* Affichage du HTML dans le block
*
* @author Grégoire Noyelle
* @since 1.0.0
*/
$template = array(
array( 'core/paragraph', array(
@gregoirenoyelle
gregoirenoyelle / block-pattern-equipe.php
Last active September 11, 2021 14:18
Block Pattern Gutenberg
<?php
// Test composition Gut 1
// A mettre dans un fichier de function dans votre thème ou dans les fichiers de votre extension
// Catégorie de Pattern
function acf_bloc_gutenberg_register_my_pattern_categories() {
// Vérifier si fonction existe
if (! function_exists('register_block_pattern_category') ) exit;
@gregoirenoyelle
gregoirenoyelle / wp-plugin-add-script-and-styles-woocom.php
Last active March 26, 2021 12:20
WordPress Extension de Thème
<?php
/*
Plugin Name: Options pour WooCommerce
Plugin URI: https://wwww.gregoirenoyelle.com
Description: Changer des réglage de WooCommerce depuis une extension.
Version: 2.0
Author: Grégoire Noyelle
Author URI: http://wwww.gregoirenoyelle.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@gregoirenoyelle
gregoirenoyelle / wp-acf-check.php
Last active December 28, 2020 15:43
ACF check
<?php
// A placer dans le fichier functions.php de votre thème
//* Contrôle si Advanced Custom Field est actif sur le site
if ( ! function_exists( 'get_field' ) ) {
// Variable pour URL de la page Extension
function page_plugin_redirect() {
return get_bloginfo('url') . '/wp-admin/plugins.php';
}
@gregoirenoyelle
gregoirenoyelle / acf-pro-options-page-multiple.php
Last active December 13, 2018 06:32
ACF Pro Page d'options
<?php // BALISE PHP À ENLEVER
/**
* Ajouter page d'options ACF 5
*
* @package ACF
*/
if( function_exists('acf_add_options_page') ) {
// Premier menu d'options
@gregoirenoyelle
gregoirenoyelle / wp-acf-image-genesis.php
Last active December 8, 2018 17:01
Add ACF image in your content
<?php
// Template Name: Image avant le contenu
//* Affichage du contenu ACF avant le contenu principal
add_action('genesis_entry_content','ap_contenu_fiche_cuisinier', 5);
function ap_contenu_fiche_cuisinier() {
//* Variables ACF pour l'image
// L'image ACF est enregistrée en tant que "ID de l'image"
$image_id = (int) get_field('nom_du_champ_image_acf');