Skip to content

Instantly share code, notes, and snippets.

/**
* Registers options with the WordPress Theme Customizer
*
*/
function register_customizer_actions( $wp_customize ) {
$wp_customize->add_section(
'menu_location',
array(
'title' => 'Primary Menu Location',
(function( $ ) {
"use strict";
wp.customize( 'genesis_background_color', function( value ) {
value.bind( function( to ) {
$( 'body' ).css( 'background-color', to );
} );
});
wp.customize( 'primary_menu_location', function( value ) {
value.bind( function( to ) {
if ( to == 'before-header' ) {
$( '.nav-primary' ).detach().prependTo( '.site-container', to );
}
if ( to == 'before-footer' ) {
$( '.nav-primary' ).detach().prependTo( '.site-footer', to );
}
//* Display the secondary navigation if page is a child of parent ID
add_action ('genesis_after_header', 'secondary_nav_if_child');
function secondary_nav_if_child() {
global $post;
if ( $post->post_parent == '10' ) {
add_action( 'genesis_after_header', 'genesis_do_subnav', 30 );
//* Display the secondary navigation if page is a child or grandchild of parent ID
add_action ('genesis_after_header', 'secondary_nav_if_child');
function secondary_nav_if_child() {
global $post;
$ancestors = get_post_ancestors($post);
if ( in_array( 10,$ancestors ) ) {
//* Remove post date if is a sticky post
add_filter( 'genesis_post_info', 'prefix_post_info_filter' );
function prefix_post_info_filter($post_info) {
if ( is_sticky() )
$post_info = 'By [post_author_posts_link] · [post_comments] [post_edit]';
return $post_info;
}
//* Remove post date if is a sticky post
add_filter( 'genesis_post_info', 'prefix_post_info_filter' );
function prefix_post_info_filter($post_info) {
if ( is_sticky() ) {
$post_info = 'By [post_author_posts_link] · [post_comments] [post_edit]';
} else {
$post_info = '[post_date] · By [post_author_posts_link] · [post_comments] [post_edit]';
//* Hook featured image into Entry Header
add_action( 'genesis_entry_header', 'newsbreak_featured_photo', 15 );
function newsbreak_featured_photo() {
$image = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'entry-image' ) ) );
if ( has_post_thumbnail() && !is_singular() ) {
printf( '<div class="featured-image"><a href="%s" title="%s">%s</a></div>', get_permalink(), the_title_attribute( 'echo=0' ), $image );
}
@bradpotter
bradpotter / style.css
Created August 7, 2014 04:59
First step to poor man's megamenu
.genesis-nav-menu .menu-item:hover > .sub-menu {
left: auto;
opacity: 1;
left: 50%;
width: 1200px;
margin-left: -600px;
background-color: #fff;
}
@bradpotter
bradpotter / style.css
Created August 10, 2014 03:02
If you do not want a maximum height limit and wish to have the slider image fully expand in both height and width, add the following CSS as well.
.education-pro-home .flexslider .slide-image {
max-height: 100%;
}