Skip to content

Instantly share code, notes, and snippets.

View ChrisCree's full-sized avatar

Chris Cree ChrisCree

View GitHub Profile
@ChrisCree
ChrisCree / genesis_accessible_styles.css
Created April 22, 2016 03:57
Genesis accessibility CSS for quick reference along with PHP code to add theme support for HTML5 markup, mobile viewport, and accessibility features in child themes.
/********** Screen Reader Text starts about line 482 ************/
th {
font-weight: 400;
}
/* ## Screen Reader Text
--------------------------------------------- */
.screen-reader-text,
@ChrisCree
ChrisCree / full-content-categories.php
Created January 24, 2014 01:10
Here's how to display full categories for specified category archives while having excerpts as the default. Add this code below to the functions.php file of your child theme.
<?php
// Do not copy opening PHP tag
// Display full content only for specified categories
add_action( 'genesis_before_loop', 'wsm_full_content_category_archive' );
/*
* Replace your-category with the slug for your category.
* If you wish to display full post content on multiple categories then
* separate the slugs with commas like this:
* 'your-category', 'your-other-category'
@ChrisCree
ChrisCree / page_idx-template.php
Created January 3, 2014 21:46
Save this file as page_idx-template.php and upload it to your child theme. Then create a page via the Pages --> Add New menu in your WordPress dashboard and select the "IDX Broker" page template.
<?php
/*
*
* Template Name: IDX Broker
*
* This template is for displaying the IDX info from
* IDXBroker.com in your Genesis child theme.
*/
add_action( 'genesis_before_content', 'wsm_idx_open_tag' );
@ChrisCree
ChrisCree / responsive-iframe.css
Created December 31, 2013 23:05
To keep iframes or other embedded objects on your site from spilling out of their parent containers when viewed on smaller screens add this to your default CSS in your style sheet. Easy peasy. :)
iframe,
object,
embed {
max-width: 100%;
}
@ChrisCree
ChrisCree / author-box.php
Last active December 31, 2015 19:19
This will customize the Author Box display in Genesis 1.0+ HTML5. Just drop it in your child theme's functions.php file.
<?php
// Don't copy the opening php tag
// Modify the author box display
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
add_action( 'genesis_before_comments', 'wsm_author_box', 8 );
remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive', 15 );
add_action( 'genesis_before_loop', 'wsm_author_box', 8 );
function wsm_author_box() {
@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
*
*/
@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 / 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 / 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
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' );