Skip to content

Instantly share code, notes, and snippets.

@studiopress
studiopress / home-link.php
Last active December 14, 2020 16:48
Genesis breadcrumbs.
@studiopress
studiopress / header-url.php
Last active June 6, 2016 14:28
Genesis header.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Modify the header URL - XHTML Version
add_filter('genesis_seo_title', 'sp_seo_title', 10, 3);
function sp_seo_title($title, $inside, $wrap) {
$inside = sprintf( '<a href="http://www.yourdomain.com" title="%s">%s</a>', esc_attr( get_bloginfo('name') ), get_bloginfo('name') );
$title = sprintf('<%s id="title">%s</%s>', $wrap, $inside, $wrap);
return $title;
}
@studiopress
studiopress / custom-favicon.php
Last active September 26, 2016 11:17
Genesis images.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Display a custom favicon
add_filter( 'genesis_pre_load_favicon', 'sp_favicon_filter' );
function sp_favicon_filter( $favicon_url ) {
return 'http://www.mydomain.com/wp-content/themes/genesis/images/favicon.ico';
}
@studiopress
studiopress / category-1.php
Last active October 27, 2017 00:10
Genesis body class.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {
if ( is_category( '1' ) )
$classes[] = 'custom-class';
return $classes;
@studiopress
studiopress / post-format-images.php
Last active December 18, 2015 01:49
Genesis post formats.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add support for post format images
add_theme_support( 'genesis-post-format-images' );
@studiopress
studiopress / allowed-tags.php
Last active June 26, 2020 22:21
Genesis comments.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'sp_remove_comment_form_allowed_tags' );
function sp_remove_comment_form_allowed_tags( $defaults ) {
$defaults['comment_notes_after'] = '';
return $defaults;
@studiopress
studiopress / customize.php
Last active October 29, 2018 14:37
Genesis entry header.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Customize the entry meta in the entry header (requires HTML5 theme support)
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter($post_info) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
return $post_info;
}
@studiopress
studiopress / customize.php
Last active January 14, 2017 02:46
Genesis entry footer.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Customize the entry meta in the entry footer (requires HTML5 theme support)
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
function sp_post_meta_filter($post_meta) {
$post_meta = '[post_categories] [post_tags]';
return $post_meta;
}
@studiopress
studiopress / add-post-navigation.php
Last active March 29, 2019 23:22
Genesis entry content.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add post navigation (requires HTML5 theme support)
add_action( 'genesis_entry_footer', 'genesis_prev_next_post_nav' );
@studiopress
studiopress / functions.php
Last active December 18, 2015 07:59
Jetpack sharing buttons.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add Jetpack share buttons above post
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
add_filter( 'the_content', 'sp_share_buttons_above_post', 19 );
add_filter( 'the_excerpt', 'sp_share_buttons_above_post', 19 );