Skip to content

Instantly share code, notes, and snippets.

View braddalton's full-sized avatar

Brad Dalton braddalton

View GitHub Profile
function after_post_text() {
echo '<div class="title-text">Add Text after all single posts here</div>';
};
add_action('genesis_after_post_content', 'after_post_text');
// Register custom widget
genesis_register_sidebar( array(
'id' => 'after-content',
'name' => __( 'After Post Content', 'child' ),
'description' => __( 'This widget executes after your single posts content.', 'child' ),
) );
// Hook widget after single post content only
add_action( 'genesis_after_post_content', 'widget_after_content', 9 );
function widget_after_content() {
genesis_register_sidebar( array(
'id' => 'text-before-blog',
'name' => 'Text Before Blog',
'description' => 'This is the widget for displaying text before blog posts.',
) );
add_action('genesis_before_content', 'apparition_text_before_blog' );
function apparition_text_before_blog() {
if( is_page(139) ) {
add_action('genesis_header', 'display_header_image');
function display_header_image(){
echo '<div class="header-image"><img src="http://yourdomain.com/images/header.png" alt="header logo" /></div>';
}
function wpsites_exclude_category_posts($query) {
if ($query->is_cat) {
$query->set('cat','-007');
}
return $query;
}
add_filter('pre_get_posts','wpsites_exclude_category_posts');
genesis_register_sidebar( array(
'id' => 'before-content',
'name' => __( 'Custom Widget', 'child' ),
'description' => __( 'This is the before content widget.', 'child' ),
) );
// Hook before-post widget to single page
add_action( 'genesis_before_content_sidebar_wrap', 'custom_before_content', 9 );
function custom_before_content() {
if ( is_single() && is_active_sidebar( 'before-content' ) ) {
add_action( 'pre_get_posts', 'exclude_category_posts_home' );
function exclude_category_posts_home( $query ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'cat', '-32' );
}
}
<?php if ( is_home() && function_exists('easingsliderlite') ) { easingsliderlite(); } ?>
<?php if ( is_front_page() && function_exists( "easingsliderlite" ) ) { easingsliderlite(); } ?>
add_action('genesis_header', 'wpsitesdotnet_slider_header_home');
/**
* @author Brad Dalton
* @example http://wpsites.net/web-design/executing-shortcodes-in-hook-locations-using-functions/
* @copyright 2014 WP Sites
*/
function wpsitesdotnet_slider_header_home() {
if (is_home()) {
echo do_shortcode('[easingsliderlite]');
}