Skip to content

Instantly share code, notes, and snippets.

View anythinggraphic's full-sized avatar
☺️
Be the reason someone smiles today.

Kevin Donnigan anythinggraphic

☺️
Be the reason someone smiles today.
View GitHub Profile
@anythinggraphic
anythinggraphic / gravity-forms-notification-popup-keep-form.php
Last active November 27, 2020 21:30
Gravity Forms Notification Popup (Genesis Framework)
<?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 / genesis-conditional-layout.php
Last active January 29, 2017 03:53
Conditionally force full-width layout
<?php
/* Force full width conditionally
----------------------------------------------------------------------------------------*/
add_action( 'genesis_meta', 'bw_force_layout' );
function bw_force_layout() {
if ( is_front_page() ) {
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}
}
@anythinggraphic
anythinggraphic / structural-wraps.php
Last active May 8, 2019 16:13
Genesis: Add structural wraps to entry-header
<?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>';
/*
Original link http://www.templatemonster.com/blog/style-checkboxes-radio-buttons-css adapted to Gravity Forms.
Uses Font Awesome. Make sure to wrap labels in <span> like so:
<script type="text/javascript">
jQuery(function($) {
$(".gfield_checkbox label, .gfield_radio label").wrapInner("<span></span>")
});
</script>
*/
/*
Original link http://www.templatemonster.com/blog/style-radioes-radio-buttons-css adapted to Gravity Forms.
Uses Font Awesome. Make sure to wrap labels in <span> like so:
<script type="text/javascript">
jQuery(function($) {
$(".gfield_checkbox label, .gfield_radio label").wrapInner("<span></span>")
});
</script>
*/
@anythinggraphic
anythinggraphic / functions.php
Last active May 8, 2019 16:13
Change the header logo link in Genesis (Updated for new themes that support HTML5 and schema rich snippets)
<?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 16:13
Change microdata for Article with the class 'entry' in Genesis child themes
<?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 January 29, 2017 03:45
Allow shortcodes in the Genesis Author Box for Users > Profile.
<?php
/* @link https://anythinggraphic.net/allow-shortcodes-in-author-box-for-genesis/
/* Allow shortcodes in the Author Box for users
----------------------------------------------------------------------------------------*/
add_filter( 'genesis_author_box', 'do_shortcode', 20 );
@anythinggraphic
anythinggraphic / functions.php
Last active May 8, 2019 16:13
Change the itemprop schema microdata attribute for navigation menu items
<?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 January 29, 2017 03:44
Remove WordPress emojis without a plugin.
<?php
/* @link https://anythinggraphic.net/disable-emojis-in-wordpress-without-a-plugin
/* Remove emoji scripts and dns prefetch
----------------------------------------------------------------------------------------*/
add_action( 'init', 'ag_disable_wp_emojicons' );
function ag_disable_wp_emojicons() {
// all actions related to emojis
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );