Skip to content

Instantly share code, notes, and snippets.

View braddalton's full-sized avatar

Brad Dalton braddalton

View GitHub Profile
@braddalton
braddalton / Remove Post Meta Single Posts
Last active December 14, 2015 08:59
This code removes the post meta on all single posts
add_action ( 'genesis_post_content' , 'remove_post_meta_single_posts' );
function remove_post_meta_single_posts) {
global $post;
if ( is_single () )
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
}
@braddalton
braddalton / Add support for custom header
Last active December 14, 2015 09:19
Add Support For Custom Header/Logo to Genesis Child Themes. Modify the width and height to match your themes header image.
add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 120 ) );
//Paste the code at the end of your child themes functions.php file and change the values to fit with your theme and header image.
@braddalton
braddalton / Change Page Layout
Last active December 14, 2015 12:18
This code changes your page layout and can be modified using any of the layout options included in Genesis
add_filter( 'genesis_pre_get_option_site_layout', 'child_do_layout' );
function child_do_layout( $opt ) {
$opt = 'full-width-content'; // Change this to any Genesis layout
return $opt;
}
/** Other options include:
* content-sidebar
* sidebar-content
* content-sidebar-sidebar
@braddalton
braddalton / Full Width Page Layout
Last active December 14, 2015 12:18
Full Width Page Layout Genesis Theme Framework
add_filter( 'genesis_pre_get_option_site_layout', 'child_do_layout' );
function child_do_layout( $opt ) {
$opt = 'full-width-content';
return $opt;
}
@braddalton
braddalton / Content Sidebar Layout Page
Last active December 14, 2015 12:18
Content Sidebar Layout Genesis Page
add_filter( 'genesis_pre_get_option_site_layout', 'child_do_layout' );
function child_do_layout( $opt ) {
$opt = 'content-sidebar';
return $opt;
}
@braddalton
braddalton / Jetpack Share Buttons Before Content
Last active December 14, 2015 14:59
Add this code to your child themes functions.php file to display your Jetpack social sharing button s before your posts content.
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
add_filter( 'the_content', 'share_buttons_above_post', 19 );
add_filter( 'the_excerpt', 'share_buttons_above_post', 19 );
function share_buttons_above_post( $content = '' ) {
if ( function_exists( 'sharing_display' ) ) {
return sharing_display() . $content;
}
@braddalton
braddalton / Delete Orphaned Post Meta in Database
Last active December 14, 2015 14:59 — forked from BFTrick/sql-command.sql
Run this database query in phpMyAdmin to remove all your orphaned post meta database tables. Note: Backup your DB first
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
@braddalton
braddalton / Remove Titles On Pages Only
Last active December 14, 2015 15:09 — forked from anonymous/gist:4424174
Removes Titles On All Pages Excluding Blog Page Archives
add_action( 'get_header', 'bourncreative_remove_page_titles' );
function bourncreative_remove_page_titles() {
if ( is_page() && ! is_page_template( 'page_blog.php' ) )
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
}
@braddalton
braddalton / Delete Page Titles
Created March 7, 2013 06:08
Delete Page Titles On All Pages Including Archives
add_action( 'get_header', 'wpsites_remove_page_titles' );
function wpsites_remove_page_titles() {
if ( is_page() && is_page_template() )
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
}
@braddalton
braddalton / Reposition Post Meta Before Posts
Created March 8, 2013 06:45
Removes the post meta from after posts content and add the post meta before posts content. Also removes the post info.
/** Remove the post meta function */
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
/** Add the post meta function before posts*/
add_action( 'genesis_before_post_content', 'genesis_post_meta' );
/** Remove the post info function */
remove_action( 'genesis_before_post_content', 'genesis_post_info' );