Skip to content

Instantly share code, notes, and snippets.

View nutsandbolts's full-sized avatar

Andrea Whitmer nutsandbolts

View GitHub Profile
@nutsandbolts
nutsandbolts / Move comment box (add to functions.php)
Created November 19, 2013 01:49
Move comment box above the comments list (Genesis)
add_action( 'genesis_before_comments' , 'nabm_post_check' );
function nabm_post_check () {
if ( is_single() ) {
if ( have_comments() ) {
remove_action( 'genesis_comment_form', 'genesis_do_comment_form' );
add_action( 'genesis_list_comments', 'genesis_do_comment_form' , 5 );
}
}
}
@nutsandbolts
nutsandbolts / Change site title URL (place in functions.php)
Last active December 31, 2015 06:19
Change the site logo URL on a Genesis site - XHTML (props to Bill Erickson)
//* Change site title URL
function be_logo_url( $title, $inside, $wrap ) {
$inside = sprintf( '<a href="%s" title="%s">%s</a>', esc_url( 'http://www.example.com' ), esc_attr( get_bloginfo( 'name' ) ), get_bloginfo( 'name' ) );
$title = sprintf( '<%s id="title">%s</%s>', $wrap, $inside, $wrap );
return $title;
}
add_filter( 'genesis_seo_title', 'be_logo_url', 10, 3 );
@nutsandbolts
nutsandbolts / Default homepage image for Facebook
Created December 14, 2013 18:38
Set a default homepage image for Facebook (functions.php)
//* Set default homepage image for Facebook
function nabm_facebook_image() {
if ( is_home() ) {
echo '<meta property="og:type" content="website" />';
echo '<meta property="og:image" content="URL-TO-IMAGE" />';
}
}
add_action( 'wp_head', 'nabm_facebook_image' );
@nutsandbolts
nutsandbolts / Remove WP version (functions.php)
Created December 25, 2013 00:58
Remove WP version from page source and enqueued scripts (goes in functions.php)
//* Remove WP version from enqueued scripts
function nabm_remove_version( $src ) {
if ( strpos( $src, 'ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'nabm_remove_version', 9999 );
add_filter( 'script_loader_src', 'nabm_remove_version', 9999 );
//* Remove WP version from page source
@nutsandbolts
nutsandbolts / shortcode function
Last active January 1, 2016 15:49
Shortcode function for John K.
//* Add shortcode for closed job listings
function job_closed_text() {
return '<div id="jobclosed"><em><p>This job opening has been filled. Nonetheless, we encourage you to apply anyway. Many of our openings are filled within hours of being posted and if we do not know who you are, we will not be able to call on you.</p><p>We are not a Monster job board. We are real, live human beings whose job it is to make connections. We promise not to waste your time.</p></em></div>';
}
add_shortcode("jobclosed", "job_closed_text");
@nutsandbolts
nutsandbolts / CSS for shortcode
Created December 29, 2013 01:46
CSS for John K.
#jobclosed {
background: #F7F7F7;
margin: 0 15px 15px 15px;
padding: 10px 20px 0 15px;
border: 1px solid #E6E6E6;
}
@nutsandbolts
nutsandbolts / Button shortcode
Created January 19, 2014 02:31
Create a button shortcode to be used in the page/post editor (goes in functions.php)
//* Add shortcode for buttons
function nabm_button_shortcode( $atts, $content = 'Click Here' ) {
extract(shortcode_atts(array(
'url' => '#'
'target' => '',
), $atts));
$target = ($target == 'blank') ? ' target="_blank"' : '';
$button = '<a target=" 'esc_attr( $target ). '" class="button" href="' . esc_url( $url ) . '">' . esc_attr( $content ) . '</a>';
return $button;
}
@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