Skip to content

Instantly share code, notes, and snippets.

View benweiser's full-sized avatar

Ben Weiser benweiser

View GitHub Profile
@benweiser
benweiser / Add A Genesis Featured Image Above Post With Title
Last active December 31, 2021 12:15
Add A Genesis Featured Image Above Post With Title - Functions.php
// Hook after header area
add_action( 'genesis_after_header', 'bw_featured_image_title' );
function bw_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' );
@benweiser
benweiser / single.php
Last active September 21, 2015 19:49
Add a custom body class to genesis single.php in your child theme's folder
<?php
add_filter('body_class', 'single_posts_body_class');
function single_posts_body_class($classes) {
$classes[] = 'custom-single';
return $classes;
}
genesis();
@benweiser
benweiser / Flickr Search Example: Nightly.markdown
Created September 4, 2015 07:01
Flickr Search Example: Nightly

Flickr Search Example: Nightly

Demo of loading images using the Flickr API with Ionic.

A Pen by Ionic on CodePen.

License.

@benweiser
benweiser / gist:2ca7267b507427864cff
Created August 28, 2015 19:14
Move titles above sidebar and content
//Moves titles above content and sidebar
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action( 'genesis_after_header', 'genesis_do_post_title', 20 );
//this removes post titles from blog archive pages as well
//Add titles back to home page, single posts, categeory archives and one specific page
add_action('get_header', 'move_other_post_titles');
function move_other_post_titles() {
if (is_home() || is_single() || is_page('contact-me') || is_category()) { // added conditional 'or is_single' and 'or is_category'
remove_action( 'genesis_after_header', 'genesis_do_post_title', 20 );
body {
/* 16px is browser default */
font-size:16px;
font-size:1rem;
/* Always use off-black */
color: #333;
}
h1,h2,h3,h4,h5,h6 {
/* Applies to all headers */
@media only screen and (max-width: 800px) {
.header-image .site-title > a {
background-size:100%;
}
}
@benweiser
benweiser / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'bw_excerpt_length' );
function bw_excerpt_length( $length ) {
return 40; // pull first 50 words
}