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

Callia Web

Websites - Design with Purpose

  • Digital toolkits
    • Venture toolkit
    • Go-pro toolkit
    • Intrepid toolkit
  • Services
    • Digital toolkits
    • Design services
    • Simple websites
    • Support and care plans
    • Website consultation
  • Our Work
  • Processes
    • Accessibility matters
    • Branding Process
    • Toolkit and website process
  • About
  • Let’s Talk

Add a line break to the site description in Genesis

2 Apr 2016 | WordPress

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 TwitterShare 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 small business owners and bloggers with their websites and online marketing. Connect with Jo and the rest of the Callia Web team on Twitter or Facebook. Alternatively send us a message.

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

  • Please enter your email address if you would like us to contact you by email with information about our services which we feel may be of interest to you. We will process your data in accordance with our privacy notice. You may withdraw this consent at any time by clicking the unsubscribe link in any message we send, or by emailing hello@calliaweb.co.uk.
Previous Post: « Salesman asking for the sale Build trust before asking for the sale
Next Post: WordCamp London 2016 – an accidental organiser’s tale wapuu at WordCamp London »

Reader Interactions

Comments

  1. Katie

    23 Apr 2016

    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 take your project to the next step?

Give us a call, we’re here to discuss what your project needs.

Let’s get started

Contact us

Telephone: 01672 666001 / 666002

Email: hello@calliaweb.co.uk

  • Facebook
  • Twitter
  • Instagram

Quick links

Digital toolkits

Services

Our work

Testimonials

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

Terms of service

Company number: 08316519

VAT number: GB204336250

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

Copyright © 2022 · Callia Web Ltd · All Rights Reserved