Skip to content

Instantly share code, notes, and snippets.

View benweiser's full-sized avatar

Ben Weiser benweiser

View GitHub Profile
@benweiser
benweiser / css-triangles
Last active August 29, 2015 14:13
CSS Triangles
div {
position:relative; /* Position must be relative to absolutely position :after */
background:#333; /* Background color to show effect */
}
div:after{
content:''; /* Required to display content */
position: absolute; /* Sets the position absolute to the top div */
top: 0;
left: 50%;
// Hides The Admin Bar On The Front End
add_filter('show_admin_bar', '__return_false');
.nav-primary .wrap {
display:table;
}
.nav-primary .menu-primary {
margin:0 auto;
display:table;
}
/* ## Float Clearing
--------------------------------------------- */
%clearfix {
&:before {
content: " ";
display: table;
}
&:after {
@benweiser
benweiser / gist:820e6eceefcb9126e318
Created June 5, 2015 18:38
Detect page template and show secondary nav
if ( is_page_template( 'about.php' ) ) {
// Returns true when 'about.php' is being used.
add_action('genesis_after_header', 'genesis_do_subnav');
} else {
// Returns false when 'about.php' is not being used.
remove_action('genesis_after_header', 'genesis_do_subnav');
}
@benweiser
benweiser / gist:5086338778753f53ea71
Created June 9, 2015 05:33
Single Portfolio Page With Bootstrap Classes
<?php
//**** Functions used on this page **//
// Show portfolio image on single portfolio page
function bw_show_featured_image() {
echo '<div class="project-image">';
$image_args = array(
'size' => 'large',
'attr' => array(
//* Do NOT include the opening php tag
//* Reposition the primary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_header', 'genesis_do_nav', 12 );
.above-post-hero {
max-width:100%;
height:400px;
background-size:cover;
background-position:50% 50%;
}
//Add hero image above post/page content
// Create new image size for our hero image
add_image_size( 'hero-image', 1400, 400, TRUE ); // creates a hero image size
// Hook after header area
add_action( 'genesis_after_header', 'bw_hero_image' );
function bw_hero_image() {
// If it is a page and has a featured thumbnail, but is not the front page do the following...
@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' )
);
}