Skip to content

Instantly share code, notes, and snippets.

View waynebcox's full-sized avatar

Wayne Cox waynebcox

View GitHub Profile
@waynebcox
waynebcox / style.css
Created January 31, 2017 02:16
Underline transition from middle out - ref: http://bradsknutson.com/blog/css-sliding-underline/
.sliding-middle-out {
display: inline-block;
position: relative;
padding-bottom: 3px;
}
.sliding-middle-out:after {
content: '';
display: block;
margin: auto;
height: 3px;
@waynebcox
waynebcox / functions.php
Last active March 4, 2017 23:29
[ Genesis ] Add full width area above header
add_action( 'genesis_header', 'utility_bar' );
/**
* Add utility bar above header.
*/
function utility_bar() {
echo '<div class="header-top">';
genesis_widget_area( 'top-header-bar', array(
'before' => '<div class="utility-bar"><div class="wrap">',
@waynebcox
waynebcox / functions.php
Last active October 21, 2016 17:57
[Genesis] Add full width widget area above footer widgets
//Bottom CTA Band
function genesischild_bottomfw() {
genesis_register_sidebar( array(
'id' => 'bottomfw',
'name' => __( 'Bottom CTA Band', 'genesis' ),
'description' => __( 'This is a full width band on internal pages', 'genesis' ),
) );
}
@waynebcox
waynebcox / Sample Script
Last active August 10, 2016 22:28
Customizing the placeholder text in Google Custom Search input
<script>
(function() {
var cx = '008259309430927337174:3jjrzypsqka';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
@waynebcox
waynebcox / Footer Content tab
Last active January 10, 2017 16:45
Dashboard Branding
@waynebcox
waynebcox / responsive-container.html
Last active August 9, 2016 20:28
Responsive iframe container
<div class="responsive-container">
<iframe src="https://www.youtube.com/embed/IHvqjtpM-Vk?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
</div>
@waynebcox
waynebcox / iphone-style.css
Last active August 9, 2016 12:40
Media queries for popular devices including non-Apple devices and tablets (based on https://css-tricks.com/snippets/css/media-queries-for-standard-devices/)
/* ----------- iPhone 5 and 5S ----------- */
/* Portrait and Landscape */
@media only screen
and (min-device-width: 320px)
and (max-device-width: 568px)
and (-webkit-min-device-pixel-ratio: 2) {
}
@waynebcox
waynebcox / functions.php
Last active August 9, 2016 12:38
[ Genesis ] Add body class based on category slug
//* Add new body class based on post category
add_filter('body_class', 'wc_category_class_single');
function wc_category_class_single($classes){
global $post;
if(is_single()) {
$category = get_the_category($post->ID);
$slug = $category[0]->slug;
$classes[] = 'post-category-'.$slug;
@waynebcox
waynebcox / functions.php
Last active August 9, 2016 12:38
[ Genesis ] Create body class based on permalink slug
//* Add a body class to single pages based on slug
add_filter( 'body_class', 'wc_body_class_for_pages' );
function wc_body_class_for_pages( $classes ) {
if ( is_singular( 'page' ) ) {
global $post;
$classes[] = 'page-' . $post->post_name;
}
return $classes;
@waynebcox
waynebcox / functions.php
Last active August 9, 2016 12:38
[ Genesis ] Make featured image the background for blog post title (based on Ben Weiser's post: https://benweiser.com/add-a-featured-post-image-with-title-in-genesis/)
// Hook after header area
add_action( 'genesis_after_header', 'squad_featured_image_title' );
function squad_featured_image_title() {
// If it is a page and has a featured thumbnail, but is not the front page do the following...
if (has_post_thumbnail() && is_single() ) {
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );