Skip to content

Instantly share code, notes, and snippets.

@michaelcarwile
michaelcarwile / functions.php
Last active December 20, 2015 04:29
Add line breaks in WordPress site description by using commas, then using PHP preg_replace to replace commas with line breaks in site description.
<?php
// don't copy php tag
// replace commas in description with line breaks
$blogdesc = get_bloginfo('description');
$blogdesc = preg_replace("/, */", "<br> ", $blogdesc);
echo $blogdesc;
?>
@michaelcarwile
michaelcarwile / functions.php
Last active December 20, 2015 04:29
Add line breaks in WordPress site description of Genesis child theme by using commas, then using PHP preg_replace to replace commas with line breaks in site description.
<?php
// don't copy php tag
// genesis replace default description with description containing line breaks
remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
add_action( 'genesis_site_description', 'child_seo_site_description');
function child_seo_site_description() {
$blogdesc = get_bloginfo('description');
$blogdesc = preg_replace("/, */", "<br>", $blogdesc); ?>
<p id="description"><?php echo $blogdesc; ?></p>
@michaelcarwile
michaelcarwile / functions.php
Last active December 20, 2015 04:29
Genesis default overrides.
<?php
// don't include above php tag
//* Remove edit link on Genesis posts
add_filter( 'genesis_edit_post_link' , '__return_false' );
@michaelcarwile
michaelcarwile / functions.php
Created July 30, 2013 19:48
Genesis clear header floats.
<?php
// do not copy/include php tag
// clear header floats
function clear_header_floats() { ?>
<div class="clear"></div>
<?php }
add_action('genesis_after_header', 'clear_header_floats');
@michaelcarwile
michaelcarwile / functions.php
Last active December 20, 2015 18:09
Add WordPress slug to body class
<?php
// don't copy php tag
//* Slug as body class
function body_class_slug( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_name;
}
return $classes;
@michaelcarwile
michaelcarwile / backstretch-genesis-functions.php
Last active December 21, 2015 13:49
Genesis HTML5 backstretch load - Replace 'themename' with theme name.
<?php
//* don't copy php tag above
//* add following code to functions.php:
//* Load backstretch js
/** Add metabox for backstretch default/fallback background image */
add_action( 'genesis_theme_settings_metaboxes', 'themename_theme_settings_metaboxes', 10, 1 );
function themename_theme_settings_metaboxes( $pagehook ) {
@michaelcarwile
michaelcarwile / wp-embed-shortcode.php
Created August 31, 2013 23:15
Embed WordPress shortcode in template file with PHP.
<?php
echo do_shortcode("[shortcode]");
?>
@michaelcarwile
michaelcarwile / sticky-footer.css
Created September 2, 2013 20:51
Sticky footer CSS
@michaelcarwile
michaelcarwile / functions.php
Last active December 22, 2015 04:48
Output/display WordPress nav descriptions on Genesis Theme
<?php
// don't copy php tag
/* Inspired by:
http://www.wpstuffs.com/add-menu-description-in-genesis/
http://www.billerickson.net/genesis-quick-tips/
*/
//* Display nav descriptions (div after text within anchor - <a href>"Menu Name"<div>"Description"</div></a>)
function add_description_nav( $item_output, $item ) {
@michaelcarwile
michaelcarwile / custom_genesis_header-functions.php
Last active December 22, 2015 04:49
Customize Genesis WordPress header
<?php
// don't copy php tag
// inspired by:
// http://www.geoffreyrickaby.com/web-development/create-a-custom-header-in-genesis
//* Custom header
remove_action('genesis_header', 'genesis_do_header');
remove_action('genesis_header', 'genesis_header_markup_open', 5);
remove_action('genesis_header', 'genesis_header_markup_close', 15);