Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrea Whitmer nutsandbolts

View GitHub Profile
View CSS for shortcode
#jobclosed {
background: #F7F7F7;
margin: 0 15px 15px 15px;
padding: 10px 20px 0 15px;
border: 1px solid #E6E6E6;
}
@nutsandbolts
nutsandbolts / shortcode function
Last active Jan 1, 2016
Shortcode function for John K.
View shortcode function
//* 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 Dec 25, 2013
Remove WP version from page source and enqueued scripts (goes in functions.php)
View Remove WP version (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 Dec 14, 2013
Set a default homepage image for Facebook (functions.php)
View Default homepage image for Facebook
//* 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 Dec 31, 2015
Change the site logo URL on a Genesis site - XHTML (props to Bill Erickson)
View Change site title URL (place in functions.php)
//* 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 / Move comment box (add to functions.php)
Created Nov 19, 2013
Move comment box above the comments list (Genesis)
View Move comment box (add to functions.php)
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 );
}
}
}
View XHTML Conditional to display widget area on page
//* Add the page widget in the content - XHTML
add_action( 'genesis_after_post_content', 'nabm_add_page_content' );
function nabm_add_page_content() {
if ( is_page('ID') )
genesis_widget_area ('page-widget', array(
'before' => '<div class="page-widget"><div class="wrap">',
'after' => '</div></div>',
) );
}
View HTML5 Conditional to display widget area on page
//* Add the page widget in the content - HTML5
add_action( 'genesis_entry_footer', 'nabm_add_page_content' );
function nabm_add_page_content() {
if ( is_page('ID') )
genesis_widget_area ('page-widget', array(
'before' => '<div class="page-widget"><div class="wrap">',
'after' => '</div></div>',
) );
}
View Register the page widget area in functions.php
genesis_register_sidebar( array(
'id' => 'page-widget',
'name' => __( 'Page Widget', 'nabm' ),
'description' => __( 'This is the widget area for a specific page.', 'nabm' ),
) );
@nutsandbolts
nutsandbolts / Base CSS for widget on page
Last active Apr 11, 2017
Add a widget area to a page using the Genesis Framework
View Base CSS for widget on page
/* Page Widget
------------------------------------------------------------ */
.page-widget {
line-height: 1.5;
padding: 30px;
}
.page-widget p {
margin-bottom: 24px;