Skip to content

Instantly share code, notes, and snippets.

@robneu
robneu / enable-author-home-page-yoast.php
Last active August 29, 2015 14:00
Enable the rel=author tag on the home page using the WordPress SEO by Yoast plugin
<?php
/**
* Enable the rel=author link on the home page regardless of authorship settings
* in the WordPress SEO by Yoast plugin.
*
* @global $post WordPress post object
* @param $gplus The author's Google+ URL
* @return $gplus The author's Google+ URL
* @author Robert Neu <http://wpbacon.com>
@robneu
robneu / simple-genesis-grid.php
Last active August 29, 2015 14:02
Create a simple Genesis grid loop by filtering the post class.
<?php
add_filter( 'post_class', 'prefix_simple_grid_class' );
/**
* Add post classes for a simple grid loop.
*
* @category Grid Loop
* @version 1.0.0
*/
function prefix_simple_grid_class( $classes ) {
<?php
add_action( 'genesis_after_header', 'prefix_do_conditional_subnav' );
function prefix_do_conditional_subnav() {
if ( ! get_field( 'sub_nav' ) ) {
return;
}
$args = array(
'theme_location' => '',
'menu' => get_field( 'sub_nav' ),
<?php
add_action( 'after_setup_theme', 'prefix_add_tertiary_menu_support', 0 );
/**
* Register the tertiary menu locations without overriding any other child theme settings.
*
* @return null Returns early if no Genesis menus are supported.
*/
function prefix_add_tertiary_menu_support() {
$menus = get_theme_support( 'genesis-menus' );
@robneu
robneu / new-header-right.php
Created June 21, 2014 21:43
Adds a new header right action to the Genesis header.
<?php
add_action( 'genesis_header', 'prefix_do_header_right' );
/**
* Adds a new action to genesis_header so the primary nav can be positioned in
* the header without being wrapped in an <aside> element.
*
* @since 1.0.0
*/
function prefix_do_header_right() {
@robneu
robneu / author-box-single.php
Last active August 29, 2015 14:03
A Genesis author box that uses template parts
<?php
/**
* The template part for displaying an author box on single entries.
*
* @see prefix_author_box()
* @see /includes/theme-functions.php
*
*/
?>
<div class="author-box">
@robneu
robneu / full-width-default-layout.php
Created June 30, 2014 16:51
Set a default full-width layout in a Genesis child theme
<?php
add_filter( 'genesis_theme_settings_defaults', 'prefix_default_full_width_layout' );
/**
* Set a full-width layout as the default in a Genesis Child theme.
*
* @author Robert Neu
* @see Genesis_Admin_Settings in genesis/lib/admin/theme-settings.php
*/
function prefix_default_full_width_layout( $settings ) {
@robneu
robneu / genesis_is_blog.php
Created July 22, 2014 23:32
Sometimes you might want to conditionally load something for the "blog" section of your Genesis website. As sites get more complex, it can be useful to load different elements conditionally and avoid duplicating code. This is one example of how you can do that.
<?php
/**
* Helper function to determine if we're on a blog section of a Genesis site.
*
* @return bool True if we're on any section of the blog.
* @author Robert Neu
*/
function prefix_is_blog() {
$is_blog = array(

Keybase proof

I hereby claim:

  • I am robneu on github.
  • I am robertneu (https://keybase.io/robertneu) on keybase.
  • I have a public key whose fingerprint is C486 BFE2 48DE 6FA6 7CAD CEC5 D506 FDC5 70D2 A57D

To claim this, I am signing this object:

<?php
/**
* Plugin Name: Remove H1 Format
* Plugin URI: http://calliaweb.co.uk/modify-tinymce-editor/
* Description: A simple plugin to remove the H1 format from the WordPress TinyMCE editor.
* Version: 0.0.1
* Author: Jo Waltham
* Author URI: http://calliaweb.co.uk/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html