Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Lifestyle Archive
*
* @package Liquor
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
@billerickson
billerickson / gist:1491863
Created December 18, 2011 00:03
Rewrite Rules
<?php
/**
* Rewrite Rules
*
* @package BE_Genesis_Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/
<?php
/**
* Metaboxes
*
* This file registers any custom metaboxes
*
* @package BE_Genesis_Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
//* Add menu item to header-right menu
add_filter( 'wp_nav_menu_items', 'custom_nav_item', 10, 2 );
function custom_nav_item( $menu, $args ) {
//* make sure we are in the primary menu
if ( 'ana-menu' !== $args->menu ) {
return $menu;
}
//* see if a nav extra was already specified with Theme options
if ( genesis_get_option( 'nav_extras' ) ) {
return $menu;
@billerickson
billerickson / gist:1209601
Created September 11, 2011 13:46
Add custom fields to Display Posts Shortcode
<?php
/**
* Add custom fields to Display Posts Shortcode
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
* @link http://www.billerickson.net/shortcode-to-display-posts/comment-page-1/#comment-4565
*
* @param $output string, the original markup for an individual post
* @param $atts array, all the attributes passed to the shortcode
* @param $image string, the image part of the output
@billerickson
billerickson / gist:1444548
Created December 7, 2011 20:42
Template Chooser
<?php
/**
* Template Chooser
* Use CPT archive templates for taxonomies
* @author Bill Erickson
* @link http://www.billerickson.net/code/use-same-template-for-taxonomy-and-cpt-archive/
*
* @param string, default template path
* @return string, modified template path
<?php
add_filter( 'genesis_nav_items', 'be_follow_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'be_follow_icons', 10, 2 );
/**
* Follow Icons in Menu
* @author Bill Erickson
* @link http://www.billerickson.net/genesis-wordpress-nav-menu-content/
*
* @param string $menu
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.com','http://www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldsite.com', 'http://www.newsite.com');
// Smooth scrolling anchor links
function ea_scroll( hash ) {
var target = $( hash );
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
var top_offset = 0;
if ( $('.site-header').css('position') == 'fixed' ) {
top_offset = $('.site-header').height();
}
if( $('body').hasClass('admin-bar') ) {
@billerickson
billerickson / functions.php
Created August 17, 2014 23:06
Using flexible content from ACF without ACF functions.
<?php
$rows = get_post_meta( get_the_ID(), 'be_content', true );
foreach( $rows as $count => $row ) {
switch ( $row ) {
case 'type_1':
$content = get_post_meta( get_the_ID(), 'be_content_' . $count . '_field_name', true );
echo '<div class="type-one">' . wpautop( $content ) . '</div>;