Skip to content

Instantly share code, notes, and snippets.

View nutsandbolts's full-sized avatar

Andrea Whitmer nutsandbolts

View GitHub Profile
@nutsandbolts
nutsandbolts / gist:704c2c3ac9e64cc28a6b
Created June 4, 2014 16:03
Move secondary nav to footer
//* Reposition secondary navigation
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_footer', 'genesis_do_subnav' );
@nutsandbolts
nutsandbolts / gist:1b7b080a4a4185bba23f
Created June 6, 2014 00:05
Footer script to open all comment links in a new tab (goes in Genesis theme settings > footer scripts box)
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
$(window).ready(function(){
//adds target blank to all comment links
$('#comments a').each(function(){
$(this).attr('target','_blank');
});
});
</script>
@nutsandbolts
nutsandbolts / gist:8f0bea7a91a6c270c731
Last active August 29, 2015 14:02
Header for custom functionality plugin
<?php
/*
Plugin Name: Nuts and Bolts Theme Functions
Plugin URI: http://www.nutsandboltsmedia.com
Description: Custom Genesis functions for the Nuts and Bolts Media website.
Version: 2.0
Author: Nuts and Bolts Media, LLC
Author URI: http://www.nutsandboltsmedia.com/
This plugin is released under the GPLv2 license. The images packaged with this plugin are the property of
@nutsandbolts
nutsandbolts / archive-videos.php
Last active August 29, 2015 14:08
Files for Video CPT Tutorial
<?php
/**
* This file adds the custom video post type archive template to a Genesis child theme.
*
*/
//* Load Isotope
wp_enqueue_script('isotope', get_stylesheet_directory_uri() . '/js/jquery.isotope.min.js', array('jquery'), '', true);
wp_enqueue_script('isotope_init', get_stylesheet_directory_uri() . '/js/isotope_init.js', array('isotope'), '1.0.0', true);
@nutsandbolts
nutsandbolts / functions.php
Created March 28, 2015 06:08
Add login/logout link to Genesis nav
//* Add login or logout to menu
add_filter( 'wp_nav_menu_items', 'sp_add_loginout_link', 10, 2 );
function sp_add_loginout_link( $items, $args ) {
// Change 'primary' to 'secondary' to put the login link in your secondary nav bar
if ( $args->theme_location != 'primary' )
return $items;
if ( is_user_logged_in() ) {
$items .= '<li class="menu-item right"><a href="'. wp_logout_url() .'">Log Out</a></li>';
} else {
@nutsandbolts
nutsandbolts / functions.php
Created April 15, 2015 03:43
Daily Bolt: open entry title links in a new tab
//* Open post title links in new tab
function nabm_filter_entry_title() {
function nabm_post_title_output( $title ) {
$title = sprintf( '<h1 class="entry-title" itemprop="headline"><a target="_blank" href="%s" title="%s">%s</a></h1>', get_permalink(), the_title_attribute( 'echo=0' ), get_the_title() );
return $title;
}
add_filter( 'genesis_post_title_output', 'nabm_post_title_output', 15 );
}
add_action('genesis_header', 'nabm_filter_entry_title');
@nutsandbolts
nutsandbolts / functions.php
Last active September 10, 2015 04:01
Daily Bolt: increase posts per page
//* Show 12 posts per page
add_action( 'pre_get_posts', 'nabm_change_posts_per_page' );
function nabm_change_posts_per_page( $query ) {
if ( ! $query->is_main_query() || is_admin() || is_feed() ) {
return $query;
}
if ( is_front_page() ) {
$query->set( 'posts_per_page', 12 );
}
return $query;
@nutsandbolts
nutsandbolts / Remove Genesis Author Box on bbPress Pages (XHTML) - add to functions.php
Last active December 27, 2015 02:58
Remove the Genesis author box from bbPress pages (XHTML child themes)
// Remove author box from forums
add_action ('genesis_after_post', 'nabm_remove_author_box' );
function nabm_remove_author_box() {
if ( is_bbpress() ) {
remove_action( 'genesis_after_post', 'genesis_do_author_box_single' );
}}
@nutsandbolts
nutsandbolts / Remove Genesis Author Box from bbPress Pages (HTML5) - add to functions.php
Last active December 27, 2015 02:59
Remove Genesis Author Box from bbPress Pages (HTML5 child themes)
// Remove author box from forums
add_action ('genesis_entry_footer', 'nabm_remove_author_box' );
function nabm_remove_author_box() {
if ( is_bbpress() ) {
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
remove_action( 'genesis_after_post', 'genesis_do_author_box_single', 8 );
}}
@nutsandbolts
nutsandbolts / Custom Genesis footer with back to top link
Created November 7, 2013 10:44
Custom footer with "back to top" link (customize and add to functions.php)