Skip to content

Instantly share code, notes, and snippets.

@GaryJones
GaryJones / functions.php
Last active September 30, 2015 01:17
Split Sidebar in Genesis - http://gamajo.com/split-sidebar-genesis
<?php
// Don't include the <?php above
add_action( 'after_setup_theme', 'prefix_register_split_sidebars', 5 );
/**
* Register the two widget areas that make up our visually separated sidebar.
*
* @author Gary Jones
* @link http://gamajo.com/split-sidebar-genesis
@billerickson
billerickson / functions.js
Created August 3, 2012 20:23
Gravity Forms labels used as placeholders
jQuery(document).ready(function($){
// gravity forms custom placeholders
$('#inner li.gfield .gfield_label').click(function(){
$(this).next('.ginput_container').find('input[type="text"], textarea').focus();
})
$('#inner .ginput_container input[type="text"], #inner .ginput_container textarea')
.focus(function(){
$(this).closest('.ginput_container').prev('.gfield_label').hide();
@jaredatch
jaredatch / .gitignore
Created September 12, 2012 23:02
Base .gitignore
.svn*
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
.gitignore
Icon?
ehthumbs.db
Thumbs.db
@thomasgriffin
thomasgriffin / gist:4159035
Last active December 30, 2019 18:27
Add custom post types to search results in WordPress.
<?php
add_filter( 'pre_get_posts', 'tgm_io_cpt_search' );
/**
* This function modifies the main WordPress query to include an array of
* post types instead of the default 'post' post type.
*
* @param object $query The original query.
* @return object $query The amended query.
*/
function tgm_io_cpt_search( $query ) {
@robneu
robneu / remove-simple-social-icons-style.php
Created October 23, 2013 10:31
Disable the output of styles in the Simple Social Icons plugin from StudioPress.
<?php
add_action( 'after_setup_theme', 'prefix_disable_simple_social_icons_styles' );
/**
* Remove Simple Social Icons styles.
*
* Simple Social Icons loads styles with a bunch of !important declarataions.
* This will disable the style output and allow you to style your icons in your
* theme more easily.
*
* @author FAT Media, LLC
@wpexplorer
wpexplorer / gist:8086713
Last active January 1, 2016 03:39
Add a shopping cart icon to WooCommerce products menu item in the WP 3.8 dashboard
// Remove WooCommerce menu.css on WP 3.8+
add_action( 'admin_print_styles', 'wpex_remove_woocommerce_admin_menu_styles' );
if ( ! function_exists('wpex_remove_woocommerce_admin_menu_styles') ) {
function wpex_remove_woocommerce_admin_menu_styles() {
global $wp_version;
if ( $wp_version >= 3.8 ) {
wp_dequeue_style( 'woocommerce_admin_menu_styles' );
}
}
}
<?php
/**
* Uses a query string (color) to apply a body class.
*
* @param array $classes
* @return array
*/
function ja_dynamic_body_class( $classes ){
if ( empty( $_GET['color'] )
@robneu
robneu / genesis-seo-post-info.php
Last active January 4, 2016 05:09
The default Genesis post info can be tweaked for a bit of extra SEO goodness. This will change your posts publish date to use the last-updated date instead. It also allows you to select a custom author page rather than using the standard post archive. This part is optional and doesn't affect the post date at all.
<?php
/**
* Some tweaks to the Genesis post info for SEO purposes.
*
* This set of functions are designed to change the output of the Genesis post info
* to reflect the date a post was updated rather than the date it was published. A
* function to set a custom author page is also included and is entirely optional.
*
* @author FAT Media, LLC
* @link http://auditwp.com/genesis-post-info-seo/
@bradpotter
bradpotter / responsive-menu.js
Last active January 4, 2016 11:09
Combine Primary and Secondary Menu into one Responsive Menu
/* Make sure your Menus are named Primary Navigation and Secondary Navigation in Appearance > Menus */
(function( window, $, undefined ) {
'use strict';
$('.nav-primary').before('<button class="menu-toggle" role="button" aria-pressed="false"></button>'); // Add toggles to menus
$('nav .sub-menu').before('<button class="sub-menu-toggle" role="button" aria-pressed="false"></button>'); // Add toggles to sub menus
// Show/hide the navigation
$('.menu-toggle, .sub-menu-toggle').click(function() {
@srikat
srikat / functions.php
Created February 5, 2014 14:05
Adding 'Last updated on: date' to post info in Genesis
//* Add last updated date to the post info in entry header (requires HTML5 theme support)
add_filter( 'genesis_post_info', 'sk_post_info_filter' );
function sk_post_info_filter($post_info) {
if (get_the_modified_time() != get_the_time()) {
$post_info = $post_info . '<br/>Last updated on: ' . the_modified_date('F j, Y', '', '', false);
}
return $post_info;
}