Skip to content

Instantly share code, notes, and snippets.

@robneu
robneu / genesis-post-nav
Created December 12, 2012 07:27
Add simple post nav to single posts in a genesis theme
/** Add Post Nav to Single Posts */
add_action ('genesis_after_post_content', 'post_navigation');
function post_navigation() {
if ( is_single() ) {
echo '<div class="post-nav">';
previous_post_link('<div class="previous-post">Previous Post: %link</div>');
next_post_link('<div class="next-post">Next Post: %link</div>');
echo '</div>';
}
}
@robneu
robneu / hacky-genesis-addthis
Created December 12, 2012 08:20
AddThis social buttons on Genesis. A little hacky, but works for right now.
<?php
/** Display Social Buttons on single post page */
add_action( 'genesis_before_post_content', 'add_social_buttons' );
add_action( 'genesis_after_post_content', 'add_social_buttons' );
function add_social_buttons() {
if ( is_single() ) {
?>
<!-- AddThis Button BEGIN -->
@robneu
robneu / general.js
Last active December 10, 2015 01:18
Add a mobile responsive menu to a Genesis Child Theme - JavaScript
jQuery(document).ready(function($){
// Show/hide the main navigation
$('.menu-toggle').click(function() {
var target = $(this).parent().children('.nav-primary');
$(target).slideToggle('fast', function() {
return false;
// Animation complete.
});
});
@robneu
robneu / theme-js.php
Last active December 10, 2015 01:18
Add a mobile responsive menu to a Genesis Child Theme - Enqueue JavaScript
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
add_action( 'wp_enqueue_scripts', 'prefix_enqueue_mobile_js' );
/**
* Add a script which depends on jQuery
* to enable a responsive menu toggle.
*
* @author FAT Media
* @link http://youneedfat.com/genesis-responsive-design-menu/
@robneu
robneu / style.css
Last active December 10, 2015 01:18
Add a mobile responsive menu to a Genesis Child Theme - Essential Styles
/*
Mobile Menu for Genesis 1.x
Version: 1.0.0
License: GPL-2.0+
License URI: http://www.opensource.org/licenses/gpl-license.php
*/
/* Primary Navigation
--------------------------------------------- */
@robneu
robneu / functions.php
Last active December 10, 2015 01:18
Add a mobile responsive menu to a Genesis Child Theme - Add to functions.php
<?php
//* Require Child Theme Functions
require_once( CHILD_DIR . '/lib/theme-js.php' );
add_action( 'genesis_header_right', 'prefix_mobile_menu_toggle', 5 );
/**
* Add a mobile menu toggle element
* to expand and collapse a mobile menu.
*
* @author FAT Media
@robneu
robneu / stolen-sidebar.js
Last active December 10, 2015 04:48
Updating a sidebar I stole from http://matthewcarleton.com/articles
jQuery(document).ready(function($){
// Optimalisation: Store the references outside the event handler:
var $window = $(window);
var offset = $("#sidebar").offset();
var topPadding = 30;
function checkWidth() {
var windowsize = $window.width();
if (windowsize > 960) {
@robneu
robneu / taxonomy-display-shortcode.php
Created January 2, 2013 23:34
A quick and dirty method for displaying a hierarchical list of taxonomy terms for a custom taxonomy called 'location'. This could/should be built out more to be more dynamic and future-friendly.
<?php
// Display taxonomy terms ordered from child to parent
function csi_ordered_tax( $terms ) {
// if terms is not array or its empty don't proceed
if ( ! is_array( $terms ) || empty( $terms ) ) {
return false;
}
foreach ( $terms as $term ) {
// if the term have a parent, set the child term as attribute in parent term
@robneu
robneu / genesis-woocommerce-sidebars.php
Last active March 2, 2016 17:23
Switch up the sidebars for various WooCommerce pages in a Genesis theme
<?php
add_filter( 'genesis_attr_sidebar-primary', 'prefix_store_sidebar_attr' );
/**
* Callback for filtering the Genesis sidebar on store pages.
*
* Add custom attributes for the custom filter.
*
* @param array $attributes The existing element attributes.
* @return array $attributes The updated element attributes.
@robneu
robneu / sublime-user-settings
Last active December 11, 2015 04:59
My Main Sublime Text 2 User Settings
{
"bold_folder_labels": true,
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Bright.tmTheme",
"dictionary": "Packages/Language - English/en_US.dic",
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",