Skip to content

Instantly share code, notes, and snippets.

@bradpotter
bradpotter / functions.php
Created September 21, 2014 01:45
Add and make new image sizes available in WordPress Uploader for Daily Dish Pro Theme - Reference http://www.wpmayor.com/how-to-add-custom-image-sizes-to-wordpress-uploader/
//* Add new image sizes
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'featured', 720, 405, TRUE );
add_image_size( 'archive', 340, 191, TRUE );
add_image_size( 'sidebar', 100, 100, TRUE );
}
//* Make new image sizes available in WordPress Uploader
add_filter('image_size_names_choose', 'my_image_sizes');
function my_image_sizes($sizes) {
@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%;
}
@bradpotter
bradpotter / style.css
Last active November 3, 2016 16:58
Full Width Slider on Education Pro Theme
.education-pro-home #genesis-responsive-slider {
max-width: 100%;
}
.education-pro-home .flexslider {
max-width: 100%;
}
.education-pro-home .flexslider .slides img {
width: 100%;
@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;
}
//* 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 );
}
//* 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] &middot; [post_comments] [post_edit]';
} else {
$post_info = '[post_date] &middot; By [post_author_posts_link] &middot; [post_comments] [post_edit]';
//* 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] &middot; [post_comments] [post_edit]';
return $post_info;
}
@bradpotter
bradpotter / functions.php
Last active July 18, 2017 08:26
How to Add “Top” and “Footer” Menus to Genesis
// Register and Hook Top Navigation Menu
add_action('genesis_before_header', 'sample_before_header_menu', 10);
function sample_before_header_menu() {
register_nav_menu( 'top', 'Top Navigation Menu' );
genesis_nav_menu( array(
'theme_location' => 'top',
'menu_class' => 'menu genesis-nav-menu menu-top',
) );
//* 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 ) ) {
//* 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 );