Skip to content

Instantly share code, notes, and snippets.

View gregoirenoyelle's full-sized avatar

Grégoire Noyelle gregoirenoyelle

View GitHub Profile
@GaryJones
GaryJones / functions.php
Created February 12, 2012 04:01 — forked from billerickson/functions.php
Genesis Grid Loop Advanced
<?php
/**
* Possibly amend the loop.
*
* Specify the conditions under which the grid loop should be used.
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@gregoirenoyelle
gregoirenoyelle / wp-new-wp-query-light.php
Last active July 12, 2018 09:40
WordPress new WP Query
<?php
// article du codex: http://codex.wordpress.org/Class_Reference/WP_Query
// Query sur Catégories d'articles (ID) (inclure)
$ma_boucle = new WP_Query( 'cat=2,6,17,38' );
// Query sur Catégories d'articles (ID) (exclure)
$ma_boucle = new WP_Query( 'cat=-12,-34,-56' );
@billerickson
billerickson / genesis-custom-loop-pagination.php
Created July 31, 2012 15:59
Genesis custom loop with pagination
<?php
/* Template Name: Test */
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed
@Vheissu
Vheissu / functions.php
Created October 22, 2012 02:36
Bundling the Advanced Custom Fields plugin into a theme using the TGM Plugin Class
add_action( 'tgmpa_register', 'register_required_plugins' );
// This function is called from the above hook
function register_required_plugins()
{
// The plugins array allows us to define multiple plugins we want to include.
// The commented out example shows how we can include and activation a bundled
// plugin zip file in our theme.
$plugins = array(
/* array(
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@justintadlock
justintadlock / register-post-type.php
Last active October 22, 2023 05:55
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@rickrduncan
rickrduncan / author-breadcrumb.php
Last active October 22, 2020 08:54
Customize Genesis breadcrumb
<?php
//* Do NOT include the opening php tag
//* Prefix author breadcrumb trail with the text 'Articles written by'
add_filter( 'genesis_breadcrumb_args', 'b3m_prefix_author_breadcrumb' );
function b3m_prefix_author_breadcrumb( $args ) {
$args['labels']['author'] = 'Articles written by ';
return $args;
@salcode
salcode / gist:7164690
Last active May 12, 2017 22:12
Genesis WordPress Framework adding custom classes to markup This gist was originally created as an example of what I perceived to be an inconsistent behavior, my error was failing to attach my code to action `genesis_setup`. Corrected version now appears below. 20131027 - merged Gary Jones's fork with corrections and refactoring
<?php
/*
* Examples to add custom classes to Genesis WordPress Framework Markup when using HTML5 output
*/
add_action( 'genesis_setup', 'srf_add_cust_classes', 15 ); // Priority 15 ensures it runs after Genesis itself has setup.
function srf_add_cust_classes() {
add_filter( 'genesis_attr_site-inner', 'srf_attr_site_inner' );
add_filter( 'genesis_attr_content-sidebar-wrap', 'srf_attr_content_sidebar_wrap' );
add_filter( 'genesis_attr_content', 'srf_attr_content' );
add_filter( 'genesis_attr_sidebar-primary', 'srf_attr_sidebar_primary' );
@jchristopher
jchristopher / gist:7312074
Last active August 12, 2020 02:43
Supplemental SearchWP search engine integration with Genesis, supports pagination
<?php
/* Template Name: Genesis and SearchWP integration with pagination */
function prefix_searchwp_form( $query ) {
echo '<form class="searchwp-form" action="" method="get">';
echo '<input type="text" id="searchwpquery" name="searchwpquery" value="' . esc_attr( $query ) . '" />';
echo '<button type="submit">' . __( 'Search', 'text-domain' ) . '</button>';
echo '</form>';
}