Skip to content

Instantly share code, notes, and snippets.

View nutsandbolts's full-sized avatar

Andrea Whitmer nutsandbolts

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / How to remove WP Dashboard widgets
Created November 7, 2013 12:03
Remove WP Dashboard widgets (functions.php)
// Remove WP dashboard widgets
function nabm_remove_dashboard_widgets() {
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
}
add_action('wp_dashboard_setup', 'nabm_remove_dashboard_widgets' );
@nutsandbolts
nutsandbolts / Add a widget to the WP Dashboard (functions.php)
Last active December 27, 2015 16:09
Add a custom widget to the WP dashboard with any content you want to include.
// Add custom dashboard widget
add_action('wp_dashboard_setup', 'nabm_dashboard_widget');
function nabm_dashboard_widget() {
global $wp_meta_boxes;
wp_add_dashboard_widget('custom_help_widget', 'ADD WIDGET TITLE HERE', 'custom_dashboard_help');
}
function custom_dashboard_help() {
echo '<p>PLACE YOUR WIDGET CONTENT HERE, INCLUDING HTML.</p>';
}
@nutsandbolts
nutsandbolts / Add a widget area to the bottom of single posts
Last active December 27, 2015 16:09
Add a widget area to the bottom of single posts (Genesis - XHTML - functions.php)
// Add the newsletter widget after the post content
add_action( 'genesis_after_post_content', 'nabm_add_newsletter_box' );
function nabm_add_newsletter_box() {
if ( is_singular( 'post' ) )
genesis_widget_area( 'newsletter', array(
'before' => '<div id="newsletter">',
) );
}
genesis_register_sidebar( array(
@nutsandbolts
nutsandbolts / Genesis homepage welcome
Last active December 27, 2015 16:09
Add a homepage-only welcome widget area to Genesis themes (functions.php)
// Add welcome message before content on homepage
add_action( 'genesis_before_loop', 'nabm_welcome_message' );
function nabm_welcome_message() {
if ( ! is_home() || get_query_var( 'paged' ) >= 2 )
return;
genesis_widget_area( 'welcome-message', array(
'before' => '<div class="welcome-message" class="widget-area">',
'after' => '</div>',
@nutsandbolts
nutsandbolts / Customize Genesis "Read More" Text
Created November 7, 2013 10:57
Customize your Genesis "Read More" Text
// Customize Read More text
add_filter( 'excerpt_more', 'nabm_more_link' );
add_filter( 'get_the_content_more_link', 'nabm_more_link' );
add_filter( 'the_content_more_link', 'nabm_more_link' );
function nabm_more_link() {
return '<a href="' . get_permalink() . '" rel="nofollow"><strong>Continue Reading...</strong></a>';
}