Skip to content

Instantly share code, notes, and snippets.

View benweiser's full-sized avatar

Ben Weiser benweiser

View GitHub Profile
// Register home featured posts widget area add this to functions.php
genesis_register_sidebar( array(
'id' => 'home-featured-posts',
'name' => __( 'Home Featured Posts', 'themename' ),
'description' => __( 'This is a widget area that is the home featured posts', '' ),
) );
@benweiser
benweiser / featured posts grid image size
Last active August 29, 2015 14:23
Defines the image size for the masonry grid
@benweiser
benweiser / Move Genesis Nav Bars
Created June 23, 2015 04:26
Move the navigation and sub-navigation in Genesis
// Move primary navigation
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );
// Move sub navigation
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before_header', 'genesis_do_subnav' );
.page-1-widget {
background:#444;
color:#fff;
margin-bottom:40px;
padding:40px 5%;
}
// See if we're on the blog post home page and if there are posts
if ( is_home() && have_posts()) {
// Get what page we are on, if not assume first page.
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
if( 1 == $paged ) {
add_action('genesis_before_loop','bw_paged_widget');
}
}
bw_page_1_widget();
function bw_page_1_widget() {
genesis_register_sidebar( array(
'id' => 'page-1-widget',
'name' => __( 'Blog Archive Widget', 'themename' ),
'description' => __( 'This is a widget area that only appears on the first page of the blog', 'themename' ),
) );
}
function bw_paged_widget(){
@benweiser
benweiser / gist:a5a497c4fd92dfe1f835
Last active November 27, 2015 23:04
Genesis Sticky Bar Hide/Reveal Styles
.top-bar {
background-color: #fff;
min-height: 70px;
padding: 10px;
padding: 1rem;
position: fixed;
transition: top 0.2s ease-in-out;
text-align: center;
width: 100%;
z-index: 99;
@benweiser
benweiser / gist:8dc2122aabe2c7bc4006
Created June 15, 2015 23:38
Genesis Sticky Top Bar Reveal JavaScript
jQuery(document).ready(function($) {
// Hide Top bar on on scroll down
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var topbarHeight = $('.top-bar').outerHeight();
$(window).scroll(function(event){
didScroll = true;
});
@benweiser
benweiser / gist:0f874722205508afa3a5
Created June 15, 2015 23:31
Sticky Top Bar Widget Reveal Functions.php
// Sticky top bar that hides on scroll down, reveals on scroll up
// Benweiser.com
function bw_sticky_bar() {
wp_enqueue_script(
'bw-sticky-bar',
get_stylesheet_directory_uri() . '/js/stickybar.js',
array( 'jquery' )
);
}