Skip to content

Instantly share code, notes, and snippets.

Kevin Donnigan anythinggraphic

Block or report user

Report or block anythinggraphic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anythinggraphic
anythinggraphic / structural-wraps.php
Last active May 8, 2019
Genesis: Add structural wraps to entry-header
View structural-wraps.php
<?php
add_action( 'genesis_entry_header', 'ag_header_wrap_open', 5 );
function ag_header_wrap_open() {
echo '<div class="wrap align-center">';
}
add_action( 'genesis_entry_header', 'ag_header_wrap_close', 14 );
function ag_header_wrap_close() {
echo '</div>';
@anythinggraphic
anythinggraphic / functions.php
Last active May 8, 2019
Change the header logo link in Genesis (Updated for new themes that support HTML5 and schema rich snippets)
View functions.php
<?php
/* @link https://anythinggraphic.net/change-header-logo-link-in-genesis-updated-for-html5-schema/
/* Updated from Bill Erickson's original post http://www.billerickson.net/code/genesis-change-logo-url to include support for new HTML5 themes and schema rich snippets.
/* Change header logo link in Genesis
----------------------------------------------------------------------------------------*/
add_filter('genesis_seo_title', 'ag_change_logo_url', 10, 3 );
function ag_change_logo_url( $title, $inside, $wrap ) {
$inside = sprintf( '<a href="%s" title="%s">%s</a>', esc_url( 'http://nmbree.org' ), esc_attr( get_bloginfo( 'name' ) ), get_bloginfo( 'name' ) );
$title = sprintf( '<%s class="site-title" itemscope="headline">%s</%s>', $wrap, $inside, $wrap );
@anythinggraphic
anythinggraphic / functions.php
Last active May 8, 2019
Change microdata for Article with the class 'entry' in Genesis child themes
View functions.php
<?php
/* @link https://anythinggraphic.net/change-class-id-itemtype-and-other-attributes-in-genesis/
/* Change microdata for Article with the class 'entry' in Genesis child themes
----------------------------------------------------------------------------------------*/
add_filter( 'genesis_attr_entry', 'ag_article_attributes', 20 );
function ag_article_attributes( $attributes ) {
if( is_singular( 'leadership' ) ) {
// class, id, itemscope, itemtype, etc.
$attributes['itemtype'] = 'http://schema.org/Organization';
@anythinggraphic
anythinggraphic / functions.php
Last active May 8, 2019
Change the itemprop schema microdata attribute for navigation menu items
View functions.php
<?php
/* @link https://anythinggraphic.net/change-navigation-menu-item-url-itemtype-schema-microdata/
/* Change microdata for specific menu items
----------------------------------------------------------------------------------------*/
add_filter( 'nav_menu_link_attributes', 'ag_menu_item_attributes', 10, 3 );
function ag_menu_item_attributes( $atts, $item, $args ) {
// The ID of the target menu item
// Remove this to target all menu items
$menu_target = 123;
@anythinggraphic
anythinggraphic / functions.php
Last active May 8, 2019
Override Header Image (Appearance > Customize) with an retina version
View functions.php
<?php
/* @link https://anythinggraphic.net/header-image-logo-in-genesis-and-wordpress-with-a-retina-2x-version/
/* Override Header Image (Appearance > Customize) with an @2x version
----------------------------------------------------------------------------------------*/
add_theme_support( 'custom-header', array(
'header_image' => '',
'header-selector' => '.site-title a',
'header-text' => false,
'height' => 188,
@anythinggraphic
anythinggraphic / functions.php
Last active May 8, 2019
Move Post Title and Post Info from Entry Header to Entry Content
View functions.php
<?php
/* Move Post Title and Post Info from inside Entry Header to Entry Content on Posts page
----------------------------------------------------------------------------------------*/
add_action( 'genesis_before_entry', 'reposition_entry_header' );
function reposition_entry_header() {
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
@anythinggraphic
anythinggraphic / gravity-forms-notification-popup-keep-form.php
Last active Jan 15, 2019
Gravity Forms Notification Popup (Genesis Framework)
View gravity-forms-notification-popup-keep-form.php
<?php
//* OPTIONAL STEP - Keep the form disappearing.
//* Gravity Forms notification popup instead of the page redirect or AJAX notification.
//* Props to @WilliamAlexander in the comments
//* @link https://anythinggraphic.net/gravity-forms-notification-popup
add_filter( 'gform_confirmation', 'ag_custom_confirmation', 10, 4 );
function ag_custom_confirmation( $confirmation, $form, $entry, $ajax ) {
add_filter( 'wp_footer', 'ag_overlay');
@anythinggraphic
anythinggraphic / functions.php
Last active Mar 13, 2018
Gravity Forms: Change Stripe receipt description.
View functions.php
/* Change the description of Gravity Forms/Stripe Form Stripe Receipt (product)
----------------------------------------------------------------------------------------*/
add_filter( 'gform_stripe_charge_description', 'ag_custom_product_receipt', 10, 4 );
function ag_custom_product_receipt( $description, $strings, $entry, $submission_data ) {
$payment_amount = rgar( $submission_data, 'payment_amount' );
$description = "Payment Amount: " . $payment_amount;
GFCommon::log_debug( __METHOD__ . "(): Custom description for the product: " . $description );
@anythinggraphic
anythinggraphic / jquery.js
Last active Nov 13, 2017
Script to move elements around based on window width
View jquery.js
// @link https://mattrad.uk/move-elements-around-using-jquery/
// Script to move elements around based on window width
jQuery(function($) {
// Store the references outside the event handler:
var $window = $(window);
var $pane1 = $('#search-dropdown');
var $pane2 = $('.social-icons');
function checkWidth() {
@anythinggraphic
anythinggraphic / loop.php
Last active Oct 18, 2017
Within your custom loop, get all taxonmies for a custom post type (CPT) and display each post within those taxonomies.
View loop.php
<?php
/* @link TBA
/* Within your custom loop, get all taxonomies for a custom post type (CPT) and display each post within those taxonomies
----------------------------------------------------------------------------------------*/
$post_type = 'your_cpt_name';
// Get all of the taxonomies for this post type
$taxonomies = get_object_taxonomies((object) array( 'post_type' => $post_type )); ?>
You can’t perform that action at this time.