Skip to content

Instantly share code, notes, and snippets.

@leepettijohn
leepettijohn / add featured image code
Last active April 16, 2019 14:06
Add Featured Image Link
@leepettijohn
leepettijohn / add featured image
Created December 16, 2014 15:51
Add Featured Image to the left of the article
@leepettijohn
leepettijohn / functions.php
Last active April 16, 2019 14:06
Removing Meta Info
add_action('genesis_before_loop','remove_info');
function remove_info(){
if (in_category(ADD_CATEGORY_NUMBER_HERE)){
//This removes the author, date, etc. at the top of the post
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
//This removes the categories and tags at the bottom of the post
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
}
@leepettijohn
leepettijohn / functions.php
Created January 2, 2015 15:25
Changing Read More Links in Blog Page
// Edit the read more link text
add_filter('get_the_content_more_link', 'custom_read_more_link');
add_filter('the_content_more_link', 'custom_read_more_link');
function custom_read_more_link() {
return '&nbsp;<a class="more-link" href="' . get_permalink() . '">Keep Reading &hellip;</a>';
}
@leepettijohn
leepettijohn / functions.php
Last active April 16, 2019 14:06
Add image to top of pages and posts
add_image_size( 'featured-top', 750, 500, TRUE );
add_action ('genesis_before_loop','add_top_image');
function add_top_image(){
if (is_page() || is_single()){
the_post_thumbnail('featured-top',array('class'=>'top-of-post'));
}
}
// Use this one if it's full width and needs to be a background image
@leepettijohn
leepettijohn / functions.php
Last active April 16, 2019 14:06
Exclude specific pages from search query
function jp_search_filter( $query ) {
if ( $query->is_search && $query->is_main_query() ) {
// unset certain pages
$query->set( 'post__not_in', array( 10,11,20,105 ) );
// setup certain categories
$query->set('cat',array('stores'));
// setup certain post types
$query->set( 'post_type', array( 'post', 'movies', 'products', 'portfolio' ) );
}
}
@leepettijohn
leepettijohn / backstretch-set.js
Created April 4, 2015 19:24
Genesis - Backstretch image
jQuery(document).ready(function($) {
$("body").backstretch([BackStretchImg.src],{duration:3000,fade:750});
});
@leepettijohn
leepettijohn / style.css
Created April 15, 2015 22:10
Placeholder text disappear
/* *** Chrome and Safari */
[placeholder]:focus::-webkit-input-placeholder {
transition: opacity 0.5s 0.5s ease;
opacity: 0;
}
/* *** Firefox */
[placeholder]:focus::-moz-placeholder {
opacity: 0;
}
@leepettijohn
leepettijohn / style.css
Created June 27, 2015 18:32
Gradients
// linear-gradient([direction], [stop] [% or px], <[stop] [% or px]>+)
// background: linear-gradient(left, rgba(255,0,0,0), red 50px, blue 100px, blue 200px, green );
#linear-grad {
//top to bottom
background: -webkit-linear-gradient(red, blue); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(red, blue); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(red, blue); /* For Firefox 3.6 to 15 */
background: linear-gradient(red, blue); /* Standard syntax */
@leepettijohn
leepettijohn / functions.php
Created July 1, 2016 15:48
Add a READ MORE link to the excerpt function
function new_excerpt_more($more) {
return '';
}
add_filter('excerpt_more', 'new_excerpt_more', 21 );
function the_excerpt_more_link( $excerpt ){
$post = get_post();
$excerpt .= '<a href="'. get_permalink($post->ID) . '">continue reading</a>';
return $excerpt;
}