Skip to content

Instantly share code, notes, and snippets.

View gregoirenoyelle's full-sized avatar

Grégoire Noyelle gregoirenoyelle

View GitHub Profile
@gregoirenoyelle
gregoirenoyelle / functions.php
Created March 3, 2012 13:05
Treow Custom Post Type display
<?php
require_once(TEMPLATEPATH.'/lib/init.php');
include_once 'metaboxes/setup.php';
// META BOXEX WP ALCHEMY
// wpalchemy metadonnees
$gn_metadonnees_mb = new WPAlchemy_MetaBox(array
(
'id' => '_custom_metadonnees', // = références
<?php
if ( get_field('gn_publier_bio') ) :
echo '<h3 class="bio-wordcampeur">Bio</h3>';
if ( in_array('biofr', get_field('gn_publier_bio') ) ) :
echo '<section class="bio-french">';
the_field('gn_bio');
endif;
echo '</section>';
if ( in_array('bioeng', get_field('gn_publier_bio') ) ) :
echo '<section class="bio-english">';
@gregoirenoyelle
gregoirenoyelle / 0_reuse_code.js
Created November 21, 2013 12:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<snippet>
<content><![CDATA[
<!DOCTYPE html>
<html>
<head>
<title>Ma page web</title>
<meta charset="utf-8">
<link rel="stylesheet" href="styles.css">
</head>
<?php // NE PAS METTRE CETTE BALISE
// A METTRE DANS VOTRE FICHIER functions.php
//* Ajouter le support de page pour les articles
add_post_type_support( 'post', 'page-attributes' );
//* Changer ordre d'affichage dans les pages d'archives des articles
add_action( 'pre_get_posts', 'gn_post_archive_order' );
function gn_post_archive_order( $query ) {
if ( $query->is_main_query() && !is_admin() && $query->is_category() || $query->is_tag() ) {
<?php
/***
* default set up for $in['toolbar1']
* bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv
* default set up for $in['toolbar2']
* formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help
* default set up for $in['block_formats']
* Paragraph=p;Address=address;Pre=pre;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5; Heading 6=h6
* @package TinyMCE
*/
<?php
/**
* Register widget area. Twenty Fiften Theme
* In functions.php file
*
* @link https://codex.wordpress.org/Function_Reference/register_sidebar
*/
function twentyfifteen_widgets_init() {
register_sidebar( array(
'name' => __( 'Widget Area', 'twentyfifteen' ),
@gregoirenoyelle
gregoirenoyelle / add_action_genesis.php
Last active July 4, 2016 10:01
Genesis Framework Tricks
<?php
// Action conditionnelle sur des Contenus personnalisés
add_action('genesis_before_loop', 'gn_temoignages_filter');
function gn_temoignages_filter() {
if ( 'gnpost_temoignage' == get_post_type() || is_post_type_archive('gnpost_temoignage') ) :
remove_action('genesis_before_post_content', 'genesis_post_info');
remove_action('genesis_after_post_content', 'genesis_post_meta');
endif;
}
@gregoirenoyelle
gregoirenoyelle / acf-genesis-flexible-structure.php
Last active February 20, 2017 09:23
ACF PRO Repeater et Flexible
<?php
// Template Name: Page avec Flexible
add_action( 'genesis_entry_content', 'gn_flexible_content', 50);
function gn_flexible_content() {
// Contrôle si le flexible a des champs
if( have_rows('flexible_content_field_name') ):
@gregoirenoyelle
gregoirenoyelle / slick-call-script-home.php
Last active February 22, 2017 14:11
ACF Widgets Slick Slider
<?php
//* Fonction pour WordPress
//Enlever la barre Admin en front
// show_admin_bar( false );
add_action( 'wp_footer', 'slick_script', 9000 );
function slick_script() {
// Si ce n'est pas l'accueil, le script s'arrête