Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / remove-standard-and-load-custom-genesis-sidebar.php
Created April 2, 2018 03:48 — forked from duroe5698/remove-standard-and-load-custom-genesis-sidebar.php
Remove Primary Sidebar and Replace with Custom Sidebar Genesis Framework Snippet
<?php
//* Insert into custom page template to remove primary sidebar and replace with your custom sidebar.
function md_do_sidebar() {
dynamic_sidebar( 'SIDEBAR ID' );
}
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'md_do_sidebar' );
?>
@jamiemitchell
jamiemitchell / Genesis Custom Sidebar
Created April 2, 2018 03:35 — forked from jacobwise/Genesis Custom Sidebar
Switch Genesis Primary sidebar for a custom sidebar
<?php
//* Remove Primary Sidebar if blog, single, or CPT
add_action( 'get_header', 'jw_remove_primary_sidebar' );
function jw_remove_primary_sidebar() {
if ( is_singular( 'post' ) || is_home() || is_singular( 'code' ) || is_singular( 'tutorial' ) || is_archive() ) {
/** Remove default sidebar */
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Customize search form input box text
add_filter( 'genesis_search_text', 'sp_search_text' );
function sp_search_text( $text ) {
return esc_attr( 'Search my blog...' );
}
@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' );
}
@jamiemitchell
jamiemitchell / style-front.css
Created March 26, 2018 01:22
Genesis Flexible Widgets
@media only screen and (min-width: 960px) {
/* Flexible Widgets
--------------------------------------------- */
.flexible-widgets .widget {
float: left;
margin-left: 3%;
}
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,