• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
Callia Web

Callia Web

Websites - Design with Purpose

  • Home
  • Websites
  • Support
  • Our Work
  • About
  • Contact

Add a line break to the site description in Genesis

2 Apr 2016

For a client’s site I need the site description to break on to a second line at a specific point.

I tried putting a <br /> where I wanted the line break in Settings  > General > Tagline but this outputs the characters <br /> rather than the line break. This is because the genesis_seo_site_description function in genesis/lib/structure/header.php (line 983) uses an esc_html on the get_bloginfo( ‘description’ ) – rightly so.

After looking at a few options like restricting the width of the .site-description class in style.css I realised I had another option. I can use the genesis_seo_description filter that is made available just before the site description is echoed.

I first wrote the function below and set it to convert any – (single dash) to a line break. But because the particular site description I was working with had the word ‘Award-winning’ in it I realised the error of my ways and set it to convert ‘ — ‘ instead (space dash dash space).

You can use whatever characters you wish instead of the “space dash dash space”, as long as they are not escaped by esc_html.

You can view this code on github.

add_filter( 'genesis_seo_description', 'jmw_site_description', 10, 3 );
/**
 * Add line break to site description at "--" in Genesis child themes
 * @link http://www.jowaltham.com/line-break-site-description-genesis
 *
 * @param string $description The html string that is output as the site description
 * @param string $inside The site description in General Settings
 * @param string $wrap The html string to wrap around the site description 
 *
 * @return string Modified description
 */
function jmw_site_description( $description, $inside, $wrap ) {
	$inside = str_replace( '--', '<br />', $inside );
	$description  = sprintf( "<{$wrap} %s>", genesis_attr( 'site-description' ) );
	$description .=  "{$inside}</{$wrap}>";
	return $description;
}

I imagine if you wanted to you could employ a similar technique to the genesis_seo_title to add a line break the site title if you wish.

Featured Image: Photo by Cody Davis on Unsplash

Share this post:

Share on FacebookShare on LinkedInShare on E-mailShare on WhatsApp

About Jo Waltham

Jo Waltham is the founder of Callia Web and is passionate about helping people with their websites.

Liked this post? Subscribe to get our next post direct to your inbox.


Previous Post:Salesman asking for the saleBuild trust before asking for the sale
Next Post:WordCamp London 2016 – an accidental organiser’s talewapuu at WordCamp London

Reader Interactions

Comments

  1. Katie

    23 Apr 2016 at 2:27 am

    Super handy bit of code; solved an issue I was working on like a charm! Thanks!!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Ready to get started?

Get in touch

Ask Callia Web’s AI

Contact us

Telephone: 01672 666001

Email: hello@calliaweb.co.uk

Quick links

Websites

Our work

Testimonials

About

Blog

Popular posts

Using headings in WordPress

Accessibility basics

Image sizes and aspect ratios

Making images equal size

Beginner’s guide to Analytics

Legal

Privacy policy / Cookie policy

Terms of service

Company number: 08316519

Registered address: Bowman House, Royal Wootton Bassett, Wiltshire, SN4 7DB

Copyright © 2025 · Callia Web Ltd · All Rights Reserved