Skip to content

Instantly share code, notes, and snippets.

Bill Erickson billerickson

Block or report user

Report or block billerickson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View functions.php
<?php
/**
* Exclude issues from blog
*
*/
function be_blog_query( $query ) {
if( $query->is_main_query() && $query->is_home() && !is_admin() ) {
$terms = get_terms( 'issue-date' );
$terms = wp_list_pluck( $terms, 'term_id' );
View functions.php
<?php
/**
* Modify Blog Query
*
*/
function be_blog_query( $query ) {
if( $query->is_main_query() && $query->is_home() && !is_admin() ) {
// customize blog query here
$query->set( 'posts_per_page', 12 );
@billerickson
billerickson / functions.php
Created Feb 9, 2014
Add category as class to display posts shortcode
View functions.php
/**
* Add category as class to display posts shortcode
*
*/
function be_dps_category_class( $classes, $post ) {
$categories = get_the_terms( $post->ID, 'category' );
foreach( $categories as $category )
$classes[] = 'cat-' . $category->slug;
return $classes;
}
View functions.php
<?php
/**
* Add Tips to Blog
*
*/
function be_tips_in_blog( $query ) {
if( $query->is_main_query() && !is_admin() && ( $query->is_home() || $query->is_tag() || $query->is_category() ) )
$query->set( 'post_type', array( 'post', 'tips' ) );
}
View functions.php
/**
* Excerpt More Link
*
*/
function be_excerpt_more( $more ) {
return ' &hellip; <a href="' . get_permalink() . '">Read More</a>';
}
add_filter( 'excerpt_more', 'be_excerpt_more', 99 );
add_filter( 'get_the_content_more_link', 'be_excerpt_more', 99 );
View gist:8975799
<form method="get" class="searchform search-form" action="http://www.billerickson.net/" role="search">
<input type="text" value="Search" name="s" class="s search-input">
<input type="hidden" name="post_type" value="diseases">
<input type="submit" class="searchsubmit search-submit" value="Submit">
</form>
View functions.php
<?php
function be_custom_loop() {
$loop = new WP_Query( $args );
if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();
$classes = 0 == $loop->current_post || 0 == $loop->current_post % 2 ? 'one-half first' : 'one-half';
echo '<div class="' . $classes . '">' . get_the_title() . '</div>';
endwhile; endif; wp_reset_postdata();
}
View functions.php
/**
* Add Podcasts to Blog
*
*/
function be_blog_query( $query ) {
if( $query->is_main_query() && !is_admin() && $query->is_home() ) {
$query->set( 'post_type', array( 'post', 'podcast' ) );
}
}
add_action( 'pre_get_posts', 'be_blog_query' );
View gist:9076974
function be_change_sidebar_order() {
$site_layout = genesis_site_layout();
if ( 'sidebar-content' == $site_layout ) {
// Remove the Primary Sidebar from the Primary Sidebar area.
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
// Place the Secondary Sidebar into the Primary Sidebar area.
add_action( 'genesis_sidebar', 'genesis_do_sidebar_alt' );
View style.css
#header ul.nav li a:hover,
#header ul.nav li a:active,
#header ul.nav .current_page_item a,
#header ul.nav .current-cat a,
#header ul.nav .current-menu-item a,
#header ul.menu li a:hover,
#header ul.menu li a:active,
#header ul.menu .current_page_item a,
#header ul.menu .current-cat a,
#header ul.menu .current-menu-item a,
You can’t perform that action at this time.