Skip to content

Instantly share code, notes, and snippets.

View braddalton's full-sized avatar

Brad Dalton braddalton

View GitHub Profile
function add_bulk_async_sdk() { ?>
<script>
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
add = function(url, id) {
if (doc.getElementById(id)) {return;}
js = doc.createElement(script);
js.src = url;
id &amp;&amp; (js.id = id);
<?php
/**
* Custom Loop for Archive Layout
* @author Bill Erickson
* @link http://www.billerickson.net/wordpress-genesis-custom-layout/
*/
function be_archive_layout_loop() {
$site_layout = genesis_site_layout();
if ( 'sidebar-content-archive' == $site_layout ) {
be_archive_loop();
<?php
/**
* Create Archive Layout
* @author Bill Erickson
* @link http://www.billerickson.net/wordpress-genesis-custom-layout/
*/
function be_create_archive_layout() {
genesis_register_layout( 'sidebar-content-archive', array(
'label' => __('Sidebar/Content Archive', 'genesis'),
'img' => get_bloginfo('stylesheet_directory') . '/images/layout-sidebar-content-archive.gif'
add_filter( 'genesis_attr_entry-image', 'be_remove_image_alignment' );
function be_remove_image_alignment( $attributes ) {
$attributes['class'] = str_replace( 'alignleft', 'alignnone', $attributes['class'] );
return $attributes;
}
if ( !class_exists('JMO_Custom_Nav')) {
class JMO_Custom_Nav {
public function add_nav_menu_meta_boxes() {
add_meta_box(
'wl_login_nav_link',
__('WishList Login'),
array( $this, 'nav_menu_link'),
'nav-menus',
'side',
'low'
add_filter( 'genesis_get_image_default_args', 'prefix_stop_auto_featured_image' );
function prefix_stop_auto_featured_image( $args ) {
if ( ! isset( $args['context'] ) || 'archive' !== $args['context'] )
return $args;
$args['fallback'] = false;
return $args;
}
<?php
/**
* Remove Image Alignment from Featured Image
*
*/
function be_remove_image_alignment( $attributes ) {
$attributes['class'] = str_replace( 'alignleft', 'alignnone', $attributes['class'] );
return $attributes;
}
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>';
/* 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;