Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / search_shortcode.php
Created March 29, 2018 22:06 — forked from cdils/search_shortcode.php
This is a modified extract from Bill Erickson's Genesis 404 Page plugin (https://github.com/billerickson/Genesis-404-Page). This bit of code adds shortcode support for a search form within a Genesis page or post.
<?php
add_action( 'init', 'cd_register_shortcode' );
/**
* Register shortcode with the theme
*/
function cd_register_shortcode() {
add_shortcode( '404-search', 'cd_search_shortcode' );
}
jQuery(document).ready(function($) {
$('input').focusin(function() {
input = $(this);
input.data('place-holder-text', input.attr('placeholder'))
input.attr('placeholder', '');
});
$('input').focusout(function() {
input = $(this);
@jamiemitchell
jamiemitchell / flexslider-init.js
Created February 4, 2018 01:43 — forked from srikat/flexslider-init.js
Single CPT template in Genesis to display ACF custom fields incl. a Gallery field as a Slider. http://sridharkatakam.com/single-cpt-template-genesis-display-acf-custom-fields-including-gallery-field-slider/
jQuery(function( $ ){
$('.flexslider').flexslider({
animation: "slide",
// pausePlay: true
pauseOnHover: true
});
});
@jamiemitchell
jamiemitchell / set-sidebar-simple-sidebar-conditionally-genesis.php
Created January 28, 2018 09:10 — forked from neilgee/set-sidebar-simple-sidebar-conditionally-genesis.php
Set sidebar conditionally to target tags, categories and posts in Genesis.php
<?php
//do not copy the above opening php tag
add_action( 'genesis_before_sidebar_widget_area', 'themeprefix_remove_sidebar' ); // starts the ball rolling
/**
* Conditionally Change Sidebar in Genesis whilst using Simple Sidebars
*
* @package Genesis Sidebar with Simple Sidebar Switcheroo
* @author Neil Gee
* @link https://wpbeaches.com/bulk-set-sidebar-categories-tags-simple-sidebars-installed-genesis/
@jamiemitchell
jamiemitchell / acf-set-field-name.php
Created January 24, 2018 00:41 — forked from solepixel/acf-set-field-name.php
Differentiate Settings Page fields when using the same field groups. Requires "menu_slug" prefixed with something common and identifiable, in this case the Post Type of the Archive as well as a common naming convention, in this example it uses "-archive-settings".
<?php
add_filter( 'acf/load_field', 'mytheme_set_field_name' );
function mytheme_set_field_name( $field ){
if( is_admin() ){
$screen = get_current_screen();
if( $screen->id == 'acf-field-group' )
return $field;
<?php
/**
* Set default Genesis Theme Options
*
* @author Joshua David Nelson, josh@joshuadnelson.com
*/
add_filter( 'genesis_theme_settings_defaults', 'jdn_theme_settings' );
function jdn_theme_settings( $defaults ) {
$defaults = array(
'update' => 1,
@jamiemitchell
jamiemitchell / unregister-widgets.php
Created January 6, 2018 05:47 — forked from carasmo/unregister-widgets.php
Unregister WordPress, Genesis, and WooCommerce widgets Raw
<?php
//Don't copy above.
add_action('widgets_init', 'cabeymer_unregister_widgets', 10);
/**
* Unregister Various Widgets
* Clean up your widgets.php page
* Single comment out the ones you want to keep
*/
@jamiemitchell
jamiemitchell / functions.php
Created January 3, 2018 23:20 — forked from hellofromtonya/functions.php
Full width Genesis Custom Header
//* Add support for custom header
add_theme_support( 'custom-header', array(
'width' => 1000, // width of the image
'height' => 70, // height of the image
'header-selector' => '.site-header', // sets it to the <header> element
'wp-head-callback' => 'lunarwp_modify_custom_header', // callback so we can modify the css added to the <head>
'header-text' => false,
) );
/**
<?php
/**
* Simple Grid helper functions.
*
* @package SimpleGrid
* @subpackage Genesis
* @copyright Copyright (c) 2014, Flagship, LLC
* @license GPL-2.0+
* @since 1.0.0
*/
@jamiemitchell
jamiemitchell / functions.php
Created December 28, 2017 22:16 — forked from jameskoster/functions.php
WooCommerce - Reorder product tabs
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['reviews']['priority'] = 5; // Reviews first
$tabs['description']['priority'] = 10; // Description second
$tabs['additional_information']['priority'] = 15; // Additional information third
return $tabs;
}