Skip to content

Instantly share code, notes, and snippets.

View braddalton's full-sized avatar

Brad Dalton braddalton

View GitHub Profile
<?php
/**
* Add Column Classes to Display Posts Shortcodes
* @author Bill Erickson
* @link http://www.billerickson.net/code/add-column-classes-to-display-posts-shortcode
*
* @param array $classes
* @param object $post
* @param object $query
* @return array $classes
add_action( 'genesis_after_sidebar_widget_area', 'child_split_sidebars' );
/**
* Add two sidebars underneath the primary sidebar.
*
* @since 1.0.0
*
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-split-sidebars
*/
function child_split_sidebars() {
/* Same as other file, but with extra notes */
/* Embedded Gists */
.line-code::before,
.line-code::after,
.line::before,
.line::after {
content: ''; /* Fixes addition of float-clearing space added to before and after global pre and div elements */
}
<?php
//* Do NOT include php tag
// register sidebar for the middle of the posts in home or archive page
genesis_register_sidebar( array(
'id' => 'sidebar-somewhere-in-the-posts',
'name' => __( 'Middle of Posts Widget Area' ),
'description' => __( 'Display widgets in the middle of your posts on the home or archive pages.' ),
) );
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_loop' ); // Add custom loop
add_filter( 'post_class', 'be_first_post_class' );
/**
* First Post Class
* Adds a class of 'first' to the first post
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/first-post-class
*
* @param array $classes
* @return array
/* redirect for slide pages */
add_action('template_redirect', 'slide_template_redirect', 1);
function slide_template_redirect(){
if ( in_category('homepage-slider') ) {
if(get_field('landing_page')){
wp_redirect( get_field('landing_page'), 301);
exit;
}
}
return;
add_action('genesis_post_content', 'title');
function title() {
if ( is_single() && genesis_get_custom_field('title') )
echo '<hr /><div id="postition_title">Title: '. genesis_get_custom_field('title') .'</div>';
}
add_action('genesis_post_content', 'phone');
function phone() {
if ( is_single() && genesis_get_custom_field('phone') )
echo '<div id="phone">Phone Number: '. '<a href="tel:' .genesis_get_custom_field('phone') . '">' . genesis_get_custom_field('phone') .'</a></div>';
<?php
/**
* Remove Image Alignment from Featured Image
*
*/
function be_remove_image_alignment( $attributes ) {
$attributes['class'] = str_replace( 'alignleft', 'alignnone', $attributes['class'] );
return $attributes;
}