Skip to content

Instantly share code, notes, and snippets.

@leepettijohn
leepettijohn / Alphabetize code
Created December 16, 2014 15:06
Alphabetize
//Alphabetize the products
function modify_query_order( $query ) {
$cat = the_category_ID($echo=false);
if (is_category(8) || cat_is_ancestor_of(8,$cat)){
global $query_string;
query_posts($query_string."&order=ASC&orderby=title");
}
}
@leepettijohn
leepettijohn / jump to form code
Created December 16, 2014 15:11
Jump to Form Upon Submission
//* Jump to message on Gravity Forms
add_filter(“gform_confirmation_anchor”, create_function(“”,”return true;”));
@leepettijohn
leepettijohn / functions.php
Created December 18, 2014 19:59
Gravity Form - Scroll to Message
//* Scroll to message on Gravity Forms
add_filter("gform_confirmation_anchor", create_function("","return true;"));
@leepettijohn
leepettijohn / functions.php
Created February 3, 2015 20:44
Genesis Framework - Add Custom Header
add_theme_support( 'custom-header', array(
'width' => 541,
'height' => 200,
'header-text' => false,
'header-selector' => '.site-title a'
)
);
@leepettijohn
leepettijohn / functions.php
Created February 5, 2015 16:19
Set "Link to" in Media to 'None'
update_option('image_default_link_type','none');
@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
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' );