Skip to content

Instantly share code, notes, and snippets.

View ChrisCree's full-sized avatar

Chris Cree ChrisCree

View GitHub Profile
@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 / 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' );
@ChrisCree
ChrisCree / FullWidthHome_functions.php
Created June 11, 2014 20:19
Drop this code into your Genesis child theme functions.php file to force the home page to display with the full width content layout.
<?php
// Do not copy opening PHP tag above
// Force full width home page layout
add_filter( 'genesis_pre_get_option_site_layout', 'wsm_full_width_home_page' );
function wsm_full_width_home_page( $opt ) {
if ( is_front_page() ) {
$opt = 'full-width-content';
return $opt;
}
@ChrisCree
ChrisCree / EventsListWidget_functions.php
Created June 12, 2014 00:04
Remove the recurring info from the Events List widget in the The Events Calendar Pro.
<?php
// Do not copy opening PHP tag above
// Events Calendar - remove recurring event info
add_filter( 'tribe_events_recurrence_tooltip', 'wsm_remove_tec_recurring_info' );
function wsm_remove_tec_recurring_info( $tooltip ) {
if( !is_singular() )
$tooltip = '';
return $tooltip;
}
@ChrisCree
ChrisCree / childVersion-functions.php
Created July 23, 2014 16:20
To make your Genesis child theme display its version in the style sheet link instead of the Genesis version add this statement to your child theme's functions.php file.
<?php
// Don't copy opening PHP tag above
// Define child theme version
define( 'CHILD_THEME_VERSION', wp_get_theme()->get( 'Version' ) );
@ChrisCree
ChrisCree / full-content-archives-genesis.php
Last active August 29, 2015 14:04 — forked from robneu/full-content-archives-genesis.php
Modified to display full content for posts in all categories.
<?php
// Do not copy opening PHP tag above
// Force content archves ti display full post content with no featured image
add_action( 'genesis_before_loop', 'wsm_full_content_categories' );
function wsm_full_content_categories() {
if ( is_category() ) {
add_filter( 'genesis_pre_get_option_content_archive_thumbnail', 'wsm_no_post_image' );
add_filter( 'genesis_pre_get_option_content_archive', 'wsm_do_full_content' );
add_filter( 'genesis_pre_get_option_content_archive_limit', 'wsm_no_content_limit' );
@ChrisCree
ChrisCree / taxtitle-functions.php
Created August 21, 2014 18:07
Add relevant page titles to custom taxonomy archive pages. This code can be dropped in the functions.php file. If used in a taxonomy.php template then omit the is_tax() conditional.
<?php
// Do not copy opening PHP tag above
// Add titles to custom taxonomy archive pages
add_action( 'genesis_before_loop', 'wsm_add_taxonomy_title' );
function wsm_add_taxonomy_title() {
if( is_tax() ) {
global $wp_query;
$term = $wp_query->get_queried_object();
$tax = $term->taxonomy;