Skip to content

Instantly share code, notes, and snippets.

View ChrisCree's full-sized avatar

Chris Cree ChrisCree

View GitHub Profile
<?php
// Add for Taxonomies
function wsm_add_for_taxonomies( $display, $meta_box, $taxonomy ) {
if ( 'taxonomy' !== $meta_box['show_on']['key'] )
return $display;
// Get the post's ID so we can see if it has ancestors
if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
@ChrisCree
ChrisCree / gist:5677645
Created May 30, 2013 13:00
Customizing the Author Box Title with the Genesis theme framework.
<?php
// Modify the author box title
add_filter('genesis_author_box_title', 'child_author_box_title');
function child_author_box_title($title) {
$title = sprintf( '<h3>%s %s</h3>', __( 'About', 'genesis' ), get_the_author() ) );
return $title;
}
@ChrisCree
ChrisCree / style.css
Created June 20, 2013 13:16
Example stylesheet header
/*
Theme Name: Kathryn
Description: Katheryn is a clean professional theme especially for accountants built on the <a href="http://web-savvy-marketing.com/go/studiopress/">Genesis framework</a>.
Author: Web Savvy Marketing
Author URI: http://www.web-savvy-marketing.com/
Version: 1.0.8
Template: genesis
*/
@ChrisCree
ChrisCree / gist:5888660
Last active March 15, 2018 22:55
Genesis doesn't put a page title on the blog page template by default. Here's a a function that will do that for you. Just drop it into your functions.php file.
<?php
// Don't copy the opening <?php tag above
// Add page title to blog page template
add_action( 'genesis_before', 'wsm_blog_page_title' );
function wsm_blog_page_title() {
if ( is_page_template( 'page_blog.php' ) ) {
add_action( 'genesis_before_content', 'wsm_show_blog_page_title_text', 2 );
}
}
@ChrisCree
ChrisCree / gist:6085625
Created July 26, 2013 02:32
Code for home.php to display only 1 post category on the home page blog.
<?php
do_action( 'genesis_home' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'wsm_custom_loop' );
function wsm_custom_loop() {
global $paged;
$args = ( array(
'category_in' => 3, // ID of category to be displayed
@ChrisCree
ChrisCree / gist:6127685
Created August 1, 2013 01:11
Some examples on how to customize the read more link in the Genesis framework.
<?php
// Add Read More button to blog page and archives
add_filter( 'excerpt_more', 'wsm_add_excerpt_more' );
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 '<div class="more-link"><a href="' . get_permalink() . '" rel="nofollow"><span>Read More</span></a></div>';
}
@ChrisCree
ChrisCree / genesis-20-columns.css
Last active December 20, 2015 21:19
Genesis 2.0 Column Classes including 5 columns. The Genesis 2.0 stylesheet includes CSS for column classes of 2, 3, 4 and 6 columns. But it leaves out 5 columns. Here's the 2.0 column classes with the 5 column styles added back in.
/* Column Classes
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.four-fifths,
.one-fifth,
.one-fourth,
.one-half,
@ChrisCree
ChrisCree / gist:6222993
Last active December 21, 2015 00:49
Force the Read More link to show on manual excerpts when the Genesis --> Theme settings is set to show post excerpts.
<?php
// Add Read More button to blog page and archives
add_filter( 'excerpt_more', 'wsm_add_excerpt_more' );
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</a></span>';
}
@ChrisCree
ChrisCree / gist:6335871
Created August 25, 2013 19:48
Remove query strings from CSS javascript files. Place this code in the Genesis child theme functions.php file.
<?php
// Don't include opening php tag above
// Remove query strings from css and javascript links
add_filter('script_loader_src', 'wsm_remove_script_version', 15, 1);
add_filter('style_loader_src', 'wsm_remove_script_version', 15, 1);
function wsm_remove_script_version( $src ) {
$parts = explode( '?', $src );
return $parts[0];
}
@ChrisCree
ChrisCree / functions.php
Last active April 18, 2020 20:51
Adding a custom.css stylesheet to your Genesis child theme (will work for non Genesis themes as well). First create a custom.css file with your custom styles and FTP it up to your child theme directory. Then add the below code to your child theme's functions.php file.
<?php
// Do not copy opening php tag above
add_action( 'wp_enqueue_scripts', 'wsm_custom_stylesheet', 20 );
function wsm_custom_stylesheet() {
wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/custom.css' );
}