-
-
Save robincornett/b23f31244424624e8ade to your computer and use it in GitHub Desktop.
Create widget areas to use with Display Featured Image for Genesis.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Do not include the opening tag! | |
add_action( 'after_setup_theme', 'leaven_register_featured_image_sidebars' ); | |
/** | |
* Register sidebars for the Display Featured Image for Genesis overlay area. | |
* One is specific to the front page, the other is site-wide. | |
* | |
* @author Robin Cornett | |
*/ | |
function leaven_register_featured_image_sidebars() { | |
$sidebars = array(); | |
if ( class_exists( 'Display_Featured_Image_Genesis' ) ) { | |
$sidebars[] = array( | |
'id' => 'over-image-home', | |
'name' => __( 'Featured Image Overlay (Front Page)', 'leaven' ), | |
'description' => __( 'This widget area overlays the featured image, but only on the front page.', 'leaven' ), | |
); | |
$sidebars[] = array( | |
'id' => 'over-image', | |
'name' => __( 'Featured Image Overlay', 'leaven' ), | |
'description' => __( 'This widget area overlays the featured image.', 'leaven' ), | |
); | |
} | |
foreach ( $sidebars as $sidebar ) { | |
genesis_register_sidebar( $sidebar ); | |
} | |
} | |
add_action( 'display_featured_image_genesis_before_title', 'leaven_featured_image_widget_area' ); | |
/** | |
* Add the featured image widget areas to the featured image, if they are active. | |
* | |
* @uses leaven_do_sidebar | |
* @author Robin Cornett | |
*/ | |
function leaven_featured_image_widget_area() { | |
$widget_area = 'over-image'; | |
if ( is_front_page() && is_active_sidebar( 'over-image-home' ) ) { | |
$widget_area = 'over-image-home'; | |
} | |
leaven_print_sidebar( $widget_area ); | |
} | |
/** | |
* Outputs the sidebar/widget area to the site. No internal wrap is added. | |
* | |
* @param $sidebar Which sidebar to be checked and output (required). | |
* @param string $class Add an extra class to the sidebar (optional). Otherwise, | |
* the class used will be the name of the sidebar. | |
* | |
* @author Robin Cornett | |
*/ | |
function leaven_print_sidebar( $sidebar, $class = '' ) { | |
if ( ! is_active_sidebar( $sidebar ) ) { | |
return; | |
} | |
$area_class = $sidebar; | |
if ( ! empty( $class ) ) { | |
$area_class .= ' ' . $class; | |
} | |
genesis_widget_area( $sidebar, array( | |
'before' => '<div class="' . $area_class . '">', | |
'after' => '</div>', | |
) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ## Search Form | |
-------------------------------------------- */ | |
.search-form input[type="search"] { | |
margin-right: 5px; | |
width: -webkit-calc(100% - 63px); | |
width: calc(100% - 63px); | |
} | |
.search-form button[type="submit"] { | |
background-color: #292c33; | |
border: 1px solid #fff; | |
border-radius: 3px; | |
color: #fff; | |
height: 58px; | |
padding: 0; | |
width: 58px; | |
} | |
.search-form button[type="submit"]:after { | |
display: inline-block; | |
font: normal normal normal 18px FontAwesome; | |
text-rendering: auto; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
-webkit-transform: translate(0, 0); | |
-ms-transform: translate(0, 0); | |
transform: translate(0, 0); | |
content: '\f002'; | |
} | |
.search-form button[type="submit"]:active, .search-form button[type="submit"]:focus, .search-form button[type="submit"]:hover { | |
background-color: #de2f25; | |
} | |
/* ## Display Featured Image for Genesis | |
-------------------------------------------- */ | |
.big-leader { | |
max-height: 800px; | |
} | |
.big-leader .wrap { | |
top: 40px; | |
} | |
.big-leader .entry-title.featured-image-overlay, | |
.big-leader .archive-title.featured-image-overlay { | |
bottom: 0; | |
font-size: 2.5em; | |
right: 0; | |
left: 0; | |
position: absolute; | |
} | |
/* ## Featured Image Overlay | |
-------------------------------------------------- */ | |
.over-image .widget_search input[type="search"] { | |
background-color: #fff; | |
background-color: rgba(255, 255, 255, 0.6); | |
} | |
.over-image .widget_search button[type="submit"] { | |
background-color: #292c33; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment