Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@johnbillion
johnbillion / hierarchy.php
Last active June 22, 2023 23:05
ASCII WordPress Template Hierarchy
<?php
/*
WordPress Theme Template Hierarchy Last updated for WordPress 5.4
==================================
This diagram is partially simplified for legibility. To view the complete template hierarchy in use on your site see the
Template panel in the Query Monitor plugin.
@GaryJones
GaryJones / functions.php
Last active December 23, 2021 23:10
Wrap the last Genesis breadcrumb in a span for styling.
<?php
add_filter( 'genesis_build_crumbs', 'gj_wrap_last_breadcrumb', 10, 2 );
/**
* Wrap the last Genesis breadcrumb in a span for styling.
*
* @author Gary Jones
*
* @param array $crumbs Existing HTML markup for the breadcrumbs.
*
@grappler
grappler / functions.php
Last active September 5, 2024 01:21
// add ie conditional html5 shim to header
<?php
// add ie conditional html5 shim to header
function _s_add_ie_html5_shim () {
echo '<!--[if lt IE 9]>';
echo '<script src="' . get_template_directory_uri() . '/js/html5.js"></script>';
echo '<![endif]-->';
}
add_action('wp_head', '_s_add_ie_html5_shim');
@westonruter
westonruter / example.php
Last active April 2, 2016 17:55
Some code we're using at XWP to make plugins easier and cleaner to write.
<?php
require_once __DIR__ . '/pluginception.php'
class ShoutPlugin {
use Pluginception;
function __construct() {
/*
* This method comes from the Pluginception trait,
@jdevalk
jdevalk / yoast-glotpress-seo.php
Last active August 9, 2016 21:24
Small SEO plugin for GlotPress
<?php
class Yoast_GlotPress_SEO {
function __construct() {
add_filter( 'gp_title', array( $this, 'modify_title' ) );
add_action( 'gp_head', array( $this, 'meta_desc' ), 9 );
add_filter( 'gp_redirect_status', array( $this, 'modify_redirect_status' ), 10, 2 );
}
@rhyswynne
rhyswynne / activation-plugin.php
Created October 28, 2014 11:04
Code to Show a Wordpress Notice asking for a review after a week (blog post here - http://winwar.co.uk/2014/10/ask-wordpress-plugin-reviews-week/)
<?php
/*
Plugin Name: Activation Plugin Example
Plugin URI:
Description: Adds an Activation Hook & Displays a notice after 10 days.
Author: Winwar Media
Version: 0.1-alpha
Author URI: http://winwar.co.uk/
Text Domain:
Domain Path:
@shadyvb
shadyvb / wp-globals.php
Created July 13, 2014 00:33
Globals in WordPress
<?php
$globals = array(
'comment',
'comment_alt',
'comment_depth',
'comment_thread_alt',
'wp_rewrite',
'in_comment_loop',
'wp_query',
filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
- 'src/wp-admin/includes/class-ftp*'
- src/wp-admin/includes/class-pclzip.php
- 'src/wp-content/*'
- 'src/wp-includes/ID3/*'
- 'src/wp-includes/SimplePie/*'
- 'src/wp-includes/Text/*'
@GaryJones
GaryJones / .csscomb.json
Last active November 2, 2018 19:49
[Replaced] CSSComb file for WP core.
See https://github.com/cedaro/grunt-wp-css/blob/develop/tasks/config/default.json
@jtsternberg
jtsternberg / trisha-import-images.php
Created May 8, 2014 18:08
Handles migrating images to local database/file-system
<?php
/*
Plugin Name: Fix Image Paths
Plugin URI: http://webdevstudios.com
Description: Plugin used to fix images that did not import properly in the MigrationService Plugin.
Author: WebDevStudios
Author URI: http://webdevstudios.com
Version: 1.0.0
License: GPLv2
*/