Skip to content

Instantly share code, notes, and snippets.

@leepettijohn
leepettijohn / index.html
Last active July 22, 2016 18:44
Rollovers in CSS
<a href="#" class="rollover" title="Webvamp"><span class="displace">Webvamp</span></a>
@leepettijohn
leepettijohn / functions.php
Created February 28, 2015 17:09
Add image size to edit pulldown
add_filter('image_size_names_choose', 'my_new_image_sizes');
function my_new_image_sizes($sizes) {
$addsizes = array(
"my-new-size" => __( "My New Size")
);
$newsizes = array_merge($sizes, $addsizes);
return $newsizes;
}
@leepettijohn
leepettijohn / functions.php
Created February 28, 2015 17:47
Format content length if no excerpt is defined
add_action ('the_content','my_excerpts');
function my_excerpts($content = false) {
global $post;
// If is the home page, an archive, or search results
if(is_front_page() || is_archive() || is_search() || is_tag()) :
global $post;
$content = $post->post_excerpt;
// If an excerpt is set in the Optional Excerpt box
if($content) :
$content = apply_filters('the_excerpt', $content);
@leepettijohn
leepettijohn / functions.php
Created February 28, 2015 22:17
Order alphabetically
add_action('genesis_before_loop', 'child_before_loop');
function child_before_loop () {
if ( !is_page() ) {
global $query_string;
query_posts($query_string . "&order=ASC&orderby=title");
}
}
@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 / functions.php
Created March 30, 2015 16:42
Genesis - Move Footer Widget Areas
remove_action('genesis_before_footer','genesis_footer_widget_areas');
add_action('genesis_footer','genesis_footer_widget_areas');
@leepettijohn
leepettijohn / functions.php
Created April 1, 2015 20:14
Gravity Form - Scroll to Confirmation Box
add_filter( 'gform_confirmation_anchor', '__return_true' );
@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 / functions.php
Created April 11, 2015 04:47
Add image size to Media Insert
add_filter('image_size_names_choose', 'my_image_sizes');
function my_image_sizes($sizes) {
$addsizes = array(
"new-size" => __( "New Size")
);
$newsizes = array_merge($sizes, $addsizes);
return $newsizes;
}
@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;
}