Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrea Whitmer nutsandbolts

View GitHub Profile
@nutsandbolts
nutsandbolts / Remove Genesis Author Box on bbPress Pages (XHTML) - add to functions.php
Last active Dec 27, 2015
Remove the Genesis author box from bbPress pages (XHTML child themes)
View Remove Genesis Author Box on bbPress Pages (XHTML) - add to functions.php
// 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 Dec 27, 2015
Remove Genesis Author Box from bbPress Pages (HTML5 child themes)
View Remove Genesis Author Box from bbPress Pages (HTML5) - add to functions.php
// 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 Nov 7, 2013
Custom footer with "back to top" link (customize and add to functions.php)
View Custom Genesis footer with back to top link
@nutsandbolts
nutsandbolts / Custom Genesis footer
Last active Dec 27, 2015
Custom footer with no "back to top" link (customize and add to functions.php)
View Custom Genesis footer
@nutsandbolts
nutsandbolts / gist:7352697
Last active Dec 27, 2015
Automatically link Twitter names to Twitter URL in blog posts and comments (functions.php)
View gist:7352697
<?php
//* DO NOT include the opening PHP tag
//* Automatically link Twitter names to Twitter URL
function twtreplace($content) {
$twtreplace = preg_replace('/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/',"$1<a href=\"http://twitter.com/$2\" target=\"_blank\" rel=\"nofollow\">@$2</a>",$content);
return $twtreplace;
}
@nutsandbolts
nutsandbolts / Change "Speak Your Mind" text
Created Nov 7, 2013
Change the "Speak Your Mind" header on Genesis comments
View Change "Speak Your Mind" text
// Change default comment text
function nabm_change_comment_text($args) {
$args['title_reply'] = 'Leave a Comment';
return $args;
}
add_filter( 'genesis_comment_form_args', 'nabm_change_comment_text' );
@nutsandbolts
nutsandbolts / Force content-sidebar layout on blog (Genesis)
Last active Jul 24, 2018
Force content-sidebar layout on blog posts when your default layout is full-width content
View Force content-sidebar layout on blog (Genesis)
//* Force sidebar on blog posts and archives
add_filter( 'genesis_pre_get_option_site_layout', 'nabm_force_layout' );
function nabm_force_layout( $opt ) {
if ( is_single() || is_archive() ) {
$opt = 'content-sidebar';
return $opt;
}
}
@nutsandbolts
nutsandbolts / Remove Edit link (Genesis)
Created Nov 7, 2013
Removes the (Edit) link from Genesis pages and posts
View Remove Edit link (Genesis)
@nutsandbolts
nutsandbolts / Enable shortcodes in widgets
Last active Dec 27, 2015
Enables you to use shortcodes in WordPress widgets
View Enable shortcodes in widgets
//* Enable shortcodes in widgets
add_filter('widget_text', 'do_shortcode');
@nutsandbolts
nutsandbolts / Enable PHP in widgets
Created Nov 7, 2013
Enable PHP in WordPress widgets without a plugin
View Enable PHP in widgets
// Enable PHP in widgets
add_filter('widget_text','execute_php',100);
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;