Skip to content

Instantly share code, notes, and snippets.

View ChrisCree's full-sized avatar

Chris Cree ChrisCree

View GitHub Profile
@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 / 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 / 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 / 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_rotator2.php
Created February 8, 2014 02:16
Example of a page template for the Genesis theme framework that adds a widget area after the header.
</php
/*
*
* Template Name: Rotator 2
*
*/
add_action( 'genesis_after_header', 'wsm_add_rotator2' );
function wsm_add_rotator2() {
@ChrisCree
ChrisCree / functions.php
Created February 15, 2014 00:32
To enable the old Link Manager in newer WordPress installations add this filter to your theme's functions.php file.
<?php
// Do not copy opening PHP tag
// Enable WordPress Link Manager
add_filter( 'pre_option_link_manager_enabled', '__return_true' );
@ChrisCree
ChrisCree / hide-select-down-arrow.css
Created February 15, 2014 21:15
Here's some CSS to display a down arrow image instead of the default select tab in the various browsers. The text-indent/text-overflow trick will hide it in FireFox. But we then have to remove the excess padding using our browser select js class. Then Internet Explorer has a pseudo class for the select box down arrow indicator. We can use displa…
div.woocommerce form.woocommerce-ordering select,
body.woocommerce-page form.woocommerce-ordering select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: url(images/arrow-down.png) no-repeat right center #fff;
height: 36px;
line-height: 1;
padding-right: 20px;
text-indent: 0.01px;
@ChrisCree
ChrisCree / taxonomy-title_functions.php
Last active August 29, 2015 13:58
Code to display the name of a category/tag/taxonomy as the title of an archive page in the Genesis framework.
<?php
// Do not copy opening PHP tag
// Display Category Title
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
add_action( 'genesis_before_loop', 'genesis_do_custom_title_description', 15 );
function genesis_do_custom_title_description() {
if ( is_category() || is_tag() || is_tax() ) {
echo '<div class="archive-description taxonomy-description"> <h1>' . get_queried_object()->name . '</h1></div>';
}
@ChrisCree
ChrisCree / WooSalesPrice_functions.php
Created April 9, 2014 05:15
Function to show original non-sale price in WooCommerce cart.
<?php
// Do not copy opening PHP tag
// Show non sale product price in cart
add_filter( 'woocommerce_cart_item_price', 'wsm_show_nonsale_price', 10, 2 );
function wsm_show_nonsale_price( $newprice, $product ) {
$_product = $product['data'];
$saleprice = $_product->sale_price;
if ( $saleprice > 0 ) {
$newprice = '';
@ChrisCree
ChrisCree / read-more-functions.php
Created May 21, 2014 18:31
The normal "read more" code for Genesis does not add the read more link to short manual excerpts. The blow code will do so.
<?php
// Do not copy opening PHP tag
// Add Read More button to blog page and archives
add_filter( 'get_the_content_more_link', 'wsm_add_excerpt_more' );
add_filter( 'the_content_more_link', 'wsm_add_excerpt_more' );
function wsm_add_excerpt_more( $more ) {
return '<span class="more-link"><a href="' . get_permalink() . '" rel="nofollow">' . __( 'Read More', 'wsm' ) . '</a></span>';
}
add_filter( 'the_excerpt', 'wsm_add_short_excerpt_more' );