Skip to content

Instantly share code, notes, and snippets.

View ryantownley's full-sized avatar

Ryan Townley ryantownley

View GitHub Profile
@ryantownley
ryantownley / functions.php
Last active March 7, 2018 18:32
Display featured image before single entry title in Genesis
<?php
//* Do NOT include the opening php tag
//* Display featured image before single entry title.
add_action( 'genesis_before_entry', 'featured_post_image', 8 );
function featured_post_image() {
if ( ! is_singular( 'post' ) ) return;
the_post_thumbnail('large');
}
@ryantownley
ryantownley / functions.php
Last active March 7, 2018 18:32
Move featured image above post title in archives
<?php
//* Do NOT include the opening php tag
//* Move featured image above entry title in archives.
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_header', 'genesis_do_post_image', 8 );
@ryantownley
ryantownley / functions.php
Last active May 19, 2016 03:11
Customize read more link text
//* Customize read more text
add_filter( 'excerpt_more', 'genesis_read_more_link' );
add_filter( 'get_the_content_more_link', 'genesis_read_more_link' );
add_filter( 'the_content_more_link', 'genesis_read_more_link' );
function genesis_read_more_link() {
return '<a class="more-link" href="' . get_permalink() . '">Continue Reading</a>';
}
@ryantownley
ryantownley / style.css
Last active May 19, 2016 03:10
Style "read more" more like a button
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.button,
.more-link { /* Add this line to existing button class */
background: none;
border: 1px solid #de6c67;
color: #de6c67;
cursor: pointer;
@ryantownley
ryantownley / functions.php
Last active May 19, 2016 03:03
This code snippet will add a "Page Header" widget area to your Genesis child theme below the header and within the wrap. It will show site-wide by default, however, you can use a widget visibility plugin such as included in Jetpack to hide or show the widget in certain areas of your site.
//* Register Page Header
genesis_register_sidebar( array(
'id' => 'page-header',
'name' => __( 'Page Header', 'genesis' ),
'description' => __( 'This is the Page Header area.', 'Genesis' ),
) );
//* Add the Page Header
add_action( 'genesis_after_header', 'genesis_page_header' );
function genesis_page_header() {
@ryantownley
ryantownley / functions.php
Last active May 19, 2016 03:04
This code snippet will add a "Page Header" widget area to your Genesis child theme below the header and outside the wrap. It will show site-wide by default, however, you can use a widget visibility plugin such as included in Jetpack to hide or show the widget in certain areas of your site.
//* Register Page Header
genesis_register_sidebar( array(
'id' => 'page-header',
'name' => __( 'Page Header', 'genesis' ),
'description' => __( 'This is the Page Header area.', 'Genesis' ),
) );
//* Add the Page Header
add_action( 'genesis_after_header', 'genesis_page_header' );
function genesis_page_header() {
@ryantownley
ryantownley / style.css
Last active May 19, 2016 03:00
Example page header style Constance theme
/* # Page Header
---------------------------------------------------------------------------------------------------- */
.page-header {
text-align: center;
}
.page-header .widget {
padding: 7% 14%;
}
@ryantownley
ryantownley / functions.php
Last active May 19, 2016 03:03
This code snippet will remove all sidebars (including header-right area), remove all layouts other than full-width, and force full-width to be selected by default in a Genesis child theme.
//* Remove sidebars and header widget area
unregister_sidebar( 'header-right' );
unregister_sidebar( 'sidebar' );
unregister_sidebar( 'sidebar-alt' );
//* Unregister layout settings
genesis_unregister_layout( 'content-sidebar' );
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
@ryantownley
ryantownley / .htaccess
Last active June 5, 2016 19:53
Expires cashing and compression code for speeding up your website.
# EXPIRES CACHING #
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
@ryantownley
ryantownley / style.css
Last active May 19, 2016 02:57
Screen reader text class.
/* ## Screen Reader Text
--------------------------------------------- */
.screen-reader-text,
.screen-reader-text span,
.screen-reader-shortcut {
position: absolute !important;
clip: rect(0, 0, 0, 0);
height: 1px;
width: 1px;