Skip to content

Instantly share code, notes, and snippets.

View wpspeak's full-sized avatar

WPSpeak wpspeak

View GitHub Profile
@wpspeak
wpspeak / functions.php
Created May 20, 2013 15:25
/** Customize the length of excerpts */
<?php
/** Customize the length of excerpts */
add_filter( 'excerpt_length', 'new_excerpt_length' );
function new_excerpt_length( $length ) {
return 30;
}
@wpspeak
wpspeak / functions.php
Last active December 17, 2015 18:09
Enable shortcode in widgets
<?php
// Add shortcode support to widgets
add_filter('widget_text', 'do_shortcode');
@wpspeak
wpspeak / functions.php
Created May 31, 2013 02:26
Exclude pages in search
<?php
/** Exclude Page in Search */
function exclude_search_pages($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
@wpspeak
wpspeak / functions.php
Created June 2, 2013 04:24
Reposition comments form in Genesis Framework
<?php
// Reposition comments form in Genesis Framework
remove_action( 'genesis_comment_form', 'genesis_do_comment_form' );
add_action( 'genesis_before_comments' , 'genesis_do_comment_form' )
@wpspeak
wpspeak / functions.php
Created June 2, 2013 20:17
Swap position of image with title and add back the post info in Genesis 2.0
<?php
// Swap image with title and add back the post info in Genesis 2.0
remove_action( 'genesis_entry_content', 'genesis_do_post_image' );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action( 'genesis_entry_header', 'genesis_do_post_image' );
add_action( 'genesis_entry_content', 'genesis_do_post_title' );
add_action( 'genesis_entry_content', 'genesis_post_info' );
@wpspeak
wpspeak / functions.php
Created June 2, 2013 20:54
Remove tags from post meta in Genesis
<?php
//* Remove tags from post meta in Genesis
add_filter( 'genesis_post_meta', 'post_meta_filter' );
function post_meta_filter($post_meta) {
if ( !is_page() ) {
$post_meta = '[post_categories before="Filed Under: "]';
return $post_meta;
}}
@wpspeak
wpspeak / functions.php
Last active December 18, 2015 00:18
Add ZillaShare shortcode plugin to post info in Genesis Framework
<?php
// Add Zillashare shortcode plugin to post info in Genesis Framework
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
if ( !is_page() ) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit] [zilla_share]';
return $post_info;
}}
@wpspeak
wpspeak / functions.php
Created June 2, 2013 23:16
Customize post info in Genesis Framework
<?php
// Customize post info in Genesis Framework
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
if ( !is_page() ) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
return $post_info;
}}
@wpspeak
wpspeak / functions.php
Created June 9, 2013 00:45
Remove Genesis Framework Layouts
<?php
// Remove Genesis layouts
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'content-sidebar' );
genesis_unregister_layout( 'full-width-content' );
@wpspeak
wpspeak / functions.php
Created June 9, 2013 21:39
Add new featured image sizes
<?php
// Add new featured image sizes
add_image_size( 'grid-thumbnail', 236, 157, TRUE );
add_image_size( 'single-post-thumbnail', 236, 236, TRUE );
add_image_size( 'video-small', 110, 73, TRUE );