Skip to content

Instantly share code, notes, and snippets.

View braddalton's full-sized avatar

Brad Dalton braddalton

View GitHub Profile
/** Widget Before Primary Sidebar */
genesis_register_sidebar( array(
'id' => 'before-primary-sidebar',
'name' => 'Before Primary Sidebar Content',
'description' => 'Displays content before the primary sidebar.',
) );
add_action( 'genesis_before_sidebar_alt_widget_area', 'wpsites_widget_before_primary_sidebar' );
@braddalton
braddalton / Genesis Sidebar Alt PHP File
Created March 27, 2013 16:11
This core Genesis file contains all the hooks which apply to the secondary sidebar
?><div id="sidebar-alt" class="sidebar widget-area">
<?php
genesis_structural_wrap( 'sidebar-alt' );
do_action( 'genesis_before_sidebar_alt_widget_area' );
do_action( 'genesis_sidebar_alt' );
do_action( 'genesis_after_sidebar_alt_widget_area' );
genesis_structural_wrap( 'sidebar-alt', 'close' );
?>
</div>
// Register Custom Widget
genesis_register_sidebar( array(
'id' => 'custom-widget',
'name' => __( 'My Custom Widget', 'child' ),
'description' => __( 'This Is My Custom Widget Area.', 'child' ),
) );
// Hook Custom Widget Before Content On The Home Page Only
add_action( 'genesis_before_content_sidebar_wrap', 'after_menu_widget', 9 );
function after_menu_widget() {
function display_slider_after_content() {
if (is_single()) {
echo do_shortcode('[easingsliderlite]');
}
};
add_action('genesis_after_post_content', 'display_slider_after_content');
@braddalton
braddalton / Display Content After Header
Last active July 25, 2016 01:29
This code outputs your custom text message after the header on all pages in Genesis.
function content_after_header() {
echo ( '<div class="after-header">Add Text Here To Display Content After Header</div>' );
}
add_action('genesis_after_header', 'content_after_header');
function text_before_comments() {
echo '<div class="comments-text">Add Text</div>';
};
add_action('genesis_after_comments', 'text_before_comments');
@braddalton
braddalton / Adsense After Specific Paragraph exclude one category
Last active December 15, 2015 14:49
Change the 007 to your category i.d
/**
* @author Brad Dalton - WP Sites
*
* @link http://wpsites.net/web-design/ads-specific-paragraph-single-posts/
*/
add_filter( 'the_content', 'wpsites_adsense_middle_content' );
function wpsites_adsense_middle_content( $content ) {
if( is_single() && in_category ('7') )
return $content;
<?php
/**
* Add Column Classes to Display Posts Shortcodes
* @author Bill Erickson
* @link http://www.billerickson.net/code/add-column-classes-to-display-posts-shortcode
*
* @param array $classes
* @param object $post
* @param object $query
* @return array $classes
function wpsites_content_columns_before_posts() {
echo '<div class="one-half first">This is an example of one half first content columns.</div>';
echo '<div class="one-half">This is an example of one half content columns.</div>';
};
add_action('genesis_before_post', 'wpsites_content_columns_before_posts');