Skip to content

Instantly share code, notes, and snippets.

View ChrisCree's full-sized avatar

Chris Cree ChrisCree

View GitHub Profile
@ChrisCree
ChrisCree / sidebar.php
Last active December 23, 2015 03:49
This is a conditional removal of the primary and secondary Genesis sidebars for compatibility with the recent changes to the Genesis Simple Sidebars plugin in themes where the primary and secondary sidebars have been replaced by theme sidebars. For Web Savvy Marketing themes, we're adding this code to the /theme-name/lib/structure/sidebar.php fi…
<?php
// Do not copy the opening php tag
// Conditionally unregister sidebar(s)
if ( ( is_admin() && wsm_is_widgets_page() ) || ( !is_admin() ) ) {
unregister_sidebar( 'sidebar' );
//unregister_sidebar( 'sidebar-alt' );
// For themes without 3 column layouts the sidebar-alt function stays in the functions.php file to remove it everywhere.
}
@ChrisCree
ChrisCree / morelink.html
Created September 17, 2013 12:18
Making a read more link overlap widget area.
@ChrisCree
ChrisCree / 0_reuse_code.js
Created September 27, 2013 23:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ChrisCree
ChrisCree / functions.php
Last active December 25, 2015 15:48
Here is a simple way to customize the output of the Author Box in the Genesis theme framework. Just drop this into your child theme's functions.php file and adjust the $pattern as desired.
<?php
// Don't copy the opening php tag above
add_filter( 'genesis_author_box', 'wsm_author_box_pattern' );
function wsm_author_box_pattern( $pattern ) {
$gravatar = get_avatar(get_the_author_id() , 80);
$author = get_the_author_meta( 'display_name' );
$description = get_the_author_meta( 'description' );
@ChrisCree
ChrisCree / clear_form_fields.js
Last active May 4, 2017 03:31
Customizing the Genesis HTML5 Comment areas to put labels inside entry fields and have them automatically clear when curser selects the fields.
jQuery(document).ready(function() {
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}
@ChrisCree
ChrisCree / functions.php
Last active October 19, 2017 20:26
Force IE not to use so-called "compatibility" mode in the Genesis theme framework.
<?php
// Do not copy opening php tag
// Force Stupid IE to NOT use compatibility mode
add_filter( 'wp_headers', 'wsm_keep_ie_modern' );
function wsm_keep_ie_modern( $headers ) {
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
$headers['X-UA-Compatible'] = 'IE=edge,chrome=1';
}
return $headers;
@ChrisCree
ChrisCree / genesis-HTML5.css
Last active December 31, 2015 16:49
These are the changes to the CSS Genesis made in version 2.0. The XHTML selectors are listed on the left and the new HTML5 selectors are listed on the right.
/* Structural
--------------------------------------------- */
#wrap .site-container
#inner .site-inner
#content-sidebar-wrap .content-sidebar-wrap
#content .content
/* Header
--------------------------------------------- */
#header .site-header
@ChrisCree
ChrisCree / functions.php
Created December 18, 2013 03:23
Move featured image above post title in Genesis 2.0+ (HTML5)
<?php
// Don't copy opening php tag
// Move featured image above post title in Genesis 2.0+ (HTML5)
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_header', 'genesis_do_post_image', 8 );
@ChrisCree
ChrisCree / functions.php
Created December 18, 2013 06:07
Add an odd/even post class to archive pages in Genesis (or WordPress generally) for styling purposes.
<?php
// don't copy openting php tag
// Add odd/even classes to blog archives
add_filter ( 'post_class' , 'wsm_oddeven_post_class' );
global $current_class;
$current_class = 'odd';
function wsm_oddeven_post_class ( $classes ) {
global $current_class;
$classes[] = $current_class;
@ChrisCree
ChrisCree / page_blog.php
Created December 18, 2013 17:58
How to show the contents from the page editor on a page using the Genesis blog page template for both XHTML and for HTML5. Create a file with the contents of this Gist. Name the file page_blog.php and FTP it up to your child theme directory. Then select the Blog page template and you should be good to go.
<?php
/**
*
* Template Name: Blog
*
* Modified Blog page template to add content area above
* blog archives
*
*/