Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@GaryJones
GaryJones / gravity-au.php
Last active April 27, 2016 15:54 — forked from thewebprincess/gravity-au.php
Australian address format for Gravity Forms.
<?php
add_filter( 'gform_address_types', 'your_plugin_slug_australian_address' );
/**
* Set Gravity Forms custom addresses for Australia.
*
* @since 1.0.0
*
* @param array $address_types Existing address formats.
* @param int $form_id Form ID.
<?php
/**
* Add Extra Code to Any Menu
* @author Bill Erickson
* @link http://www.billerickson.net/customizing-wordpress-menus/
*
* @param string $menu
* @param object $args
* @return string modified menu
*/
@GaryJones
GaryJones / gist:7183071
Last active December 26, 2015 16:49 — forked from salcode/gist:7164690
<?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' );
<?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 );
}
@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
*
*/
<?php
// Replace your current wps_do_pitbull_image_three() with:
function wps_do_pitbull_image_three() {
wps_id_open( 'pitbull_image_three' );
global $post;
wps_id_open( 'pitbull_image_three' );
echo '<p><img src="' .get_post_meta( $post->ID, '_d2c_pitbull_image_three', true ).'" /></p>';
@GaryJones
GaryJones / functions.php
Last active December 11, 2015 01:18
Customize Genesis search input and button.
<?php
add_filter( 'genesis_search_text', 'custom_search_input_text' );
/**
* Customize the search form input button text.
*
* @param string $text Existing input text.
*
* @return string Amended input text.
*/
<?php
add_filter( 'genesis_post_meta', 'post_meta_filter' );
// Customize the post meta function
function post_meta_filter( $post_meta ) {
return '[post_categories before="Filed Under: "] [post_tags before="Tagged: "]';
}
// Remove the post meta function
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
<?php
// Create color style options
add_theme_support( 'genesis-style-selector', array(
'theme-blue' => __( 'Blue', 'your-child-theme-text-domain' ),
'theme-green' => __( 'Green', 'your-child-theme-text-domain' ),
'theme-orange' => __( 'Orange', 'your-child-theme-text-domain' ),
'theme-red' => __( 'Red', 'your-child-theme-text-domain' ),
) );
<?php
// Remove the author box on single posts
remove_action( 'genesis_after_post', 'genesis_do_author_box_single' );
// Display author box on single posts
add_filter( 'get_the_author_genesis_author_box_single', '__return_true' );
// Display author box on archive pages
add_filter( 'get_the_author_genesis_author_box_archive', '__return_true' );