Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@GaryJones
GaryJones / gist:7057100
Last active December 25, 2015 23:29
WordPress: Allow anchor target attribute in user biography field.
<?php
// Don't include the above
add_filter( 'wp_kses_allowed_html', 'georgef_allow_anchor_target_attribute_in_biography', 20, 2 );
/**
* Allow links to have a target attribute in user biographical information.
*
* @author Gary Jones
* @link http://www.studiopress.com/forums/topic/about-the-author-box-can-open-links-in-new-window/
@GaryJones
GaryJones / functions.php
Created October 19, 2013 03:04
Genesis: Change date format in Primary Nav Extras.
<?php
// Don't include the above
add_filter( 'wp_nav_menu_items', 'prefix_change_nav_date_format', 15, 2 );
/**
* Filter the Primary Navigation menu items in Genesis, to change the date format.
*
* @author Gary Jones
* @link http://www.studiopress.com/forums/topic/abbreviate-month-in-primary-navigation-bar-enterprise/
@GaryJones
GaryJones / readme.md
Last active July 14, 2019 20:46
Custom Featured Post Widget plugin: Skeleton for amending the output of the Genesis Featured Post widget.
@GaryJones
GaryJones / functions.php
Last active April 16, 2019 14:23
Remove the Floating Social Bar output from inside the entry-content div in Genesis child themes, and add it just before entry-content instead.This keeps the itemprop="text" for the BlogPosting / CreativeWork itemtype from starting with the textual content of Floating Social Bar.
<?php
add_action( 'pre_get_posts', 'mfsbig_remove_floating_social_bar', 15 );
/**
* Remove Floating Social Bar from outputting at the top of the content.
*
* FSB adds these filters at pre_get_posts, priorty 10, so we'll remove them
* just after that.
*
* @author Gary Jones
@GaryJones
GaryJones / functions.php
Created August 30, 2013 20:52
Use gettext filter to change the name of the menu location added by Genesis Header Nav plugin. Combine this with a filtered priority of <5 to place it before the site header element.
<?php
add_filter( 'gettext', 'prefix_genesis_header_nav_name', 10, 3 );
/**
* Change the name of the Header menu location added by Genesis Header Nav plugin.
*/
function prefix_genesis_header_nav_name( $translated_text, $original_text, $domain ) {
if ( 'genesis-header-nav' === $domain && 'Header' === $original_text )
return 'Top';
}
<?php
//* Do NOT include the opening php tag
//* Add Organization schema to our logo
add_filter( 'genesis_seo_title', 'rvam_header_title', 10, 3 );
function rvam_header_title( $title, $inside, $wrap ) {
$inside = sprintf( '<div itemscope="itemscope" itemtype="http://schema.org/Organization"><a itemprop="url" href="%s" title="%s"><img class="logo" itemprop="logo" src="http://www.rvamedia.com/img/rva-media.png" alt="%s" /></a></div>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), get_bloginfo( 'name' ) );
return sprintf( '<%1$s id="title">%2$s</%1$s>', 'span', $inside );
}
<?php
/**
* Registers an option sanitization filter.
*
* If the option is an "array" option type with "suboptions", you have to use the third param to specify the
* suboption or suboptions you want the filter to apply to. DO NOT call this without the third parameter on an option
* that is an array option, because in that case it will apply that filter to the array(), not each member.
*
* Use the 'genesis_settings_sanitizer_init' action to be notified when this function is safe to use
@GaryJones
GaryJones / functions.php
Last active December 20, 2015 19:19
Temporary fix for an incorrect escaping in genesis_post_author_link_shortcode() for Genesis 2.0.0.
<?php
// Don't include the above <?php when copying and pasting to your child theme functions.php!
add_filter( 'genesis_post_info', 'gmj_fix_post_info_linked_author', 10, 2 );
/**
* Temporary fix for an incorrect escaping in genesis_post_author_link_shortcode() for Genesis 2.0.0.
*
* This function can probably be removed once Genesis 2.0.1 is released.
*
@GaryJones
GaryJones / reverse-post-order.php
Last active December 19, 2015 10:29 — forked from robneu/reverse-post-order.php
Completely untested!
<?php
add_action( 'pre_get_posts', 'prefix_reverse_post_order' );
/**
* Reverse Post Order for Post Archives on the Genesis Framework
*
* @author FAT Media
* @link http://youneedfat.com/reverse-post-order-genesis-framework/
* @param object $query data
*
*/
@GaryJones
GaryJones / annotated-style.css
Last active December 18, 2015 13:48
CSS styles to fix the appearance of embedded gists in Genesis 2.0 / Sample child theme.
/* Same as other file, but with extra notes */
/* Embedded Gists */
.line-pre::before,
.line-pre::after,
.line::before,
.line::after {
content: ''; /* Fixes addition of float-clearing space added to before and after global pre and div elements */
}