ThemeShaper Forums » Thematic

[closed]

Need to include a line break in blog description

(9 posts)
  • Started 2 years ago by mjkane
  • Latest reply from em hr
  • This topic is not resolved
  1. How do I force a line break into the blog description? I know you can't do it directly from the admin and I can't see a place to do it directly in header.php. Anyone?

    Posted 2 years ago #
  2. are you sure you can't put a
    in the admin side? haven't tried it myself.

    you could also override the thematic_blogdescription() with childtheme_override_blogdescription() and do it with a string replace

    Posted 2 years ago #
  3. yes. When you hit your enter key while your cursor is in the description field, you don't go to a new line. Does the function you suggest go in functions.php?

    Posted 2 years ago #
  4. well i know it is a text input so you can't hit the enter key. but i tried to type the code for line break and it got gobbled up

    <br />

    i meant to ask are you sure you can't put that in your text input?

    and yes, with thematic and child themes, ALL functions you write go in your child's functions.php

    Posted 2 years ago #
  5. Thanks for the reply Helga (not really a viking are you?) but yes, the HTML
    tag was the first thing I tried. WordPress just outputs that as a literal string, not as an html tag. Seems kinda crazy that something so simple should be that difficult. :)

    Posted 2 years ago #
  6. The problem is that get_bloginfo() calls are filtered by esc_html() You'll need to decode the entities and strip them from the title tag.

    Give this a try:

    function childtheme_override_blogdescription ()  {
        $blogdesc = '"blog-description">' . html_entity_decode( get_bloginfo('description', 'display') );
    	if ( is_home() || is_front_page() ) {
    		echo "\t<h1 id=$blogdesc</h1>\n\n";
        } else {
    		echo "\t<div id=$blogdesc</div>\n\n";
    	}
    }
    
    function childtheme_strip_tags($content) {
    $content['content'] = strip_tags( html_entity_decode($content['content']) );
    return $content;
    }
    add_filter('thematic_doctitle', 'childtheme_strip_tags');
    Posted 2 years ago #
  7. tiger
    Member

    Thanks for the help on this. Does this code go in functions.php? And do
    tags need to be in the description? I'm a little unclear on what you mean by "You'll need to decode the entities and strip them from the title tag."

    Posted 2 years ago #
  8. all PHP goes in functions.PHP

    all CSS goes in style.CSS

    "You'll need to decode the entities and strip them from the title tag."... i think he just means that normally all the html tags are stripped... instead you decode them so they remain HTML characters and aren't converted to string. if you are trying to do the same thing why don't you try gene's (em_hr) code and see if it works.

    Posted 2 years ago #
  9. WP encodes the blog description content that you enter in the wp-admin before string the information in the database. That is why html tags are output as entity encoded text when used there.

    The childtheme_override_blogdescription() I provided allows for those entities to be decoded and rendered as html.

    The childtheme_strip_tags() removes decodes and removes the user submitted tags from thematic's title tag function. If this weren't done html would show up as encoded text inside the title tag. Not pretty.

    I think that this works within the confines of Thematic. But using html where WP does not intend it by default has the potential to open up a can of worms elsewhere.

    Say for instance if you were to use Headspace or Yoast's WP SEO plugins or any plugin that calls the blog description from the database.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.