How to Add a Welcome Text Widget to Your Website

Some of you may have noticed a rather obtrusive, large font, full-width section that sits at the top the eleven40 demo site. It’s on every page, screams in your face and is hard to ignore.

I’d like to introduce you to my Welcome Text Widget.

And in case you missed it, it’s the thing that sits just below the header, above the content area and says:

A mobile-responsive child theme built for the Genesis Framework.

Now you know what I’m talking about?

How to Fetch You Some Welcome Text Widget

As promised, I’m writing up this tutorial which will show you (just how easy it is) to add a welcome text widget to your website. If you can follow directions, then you might be able to put some witty text at the top of your site too!

In case you’re wondering, this code is lifted from our eleven40 Theme – which by the way is the same theme that I’m running here.

Moving right along…

1. Register Your Widget Area

Open up your child theme’s functions.php file, and place the following code:

/** Register widget areas */
genesis_register_sidebar( array(
    'id'    => 'welcome-text',
    'name'    => __( 'Welcome Text', 'genesis' ),
    'description'    => __( 'This is the welcome text widget.', 'themename' ),
) );

2. Hook the Welcome Text widget

Also in your child theme’s functions.php file, place the following code:

/** Add the welcome text section */
add_action( 'genesis_before_content_sidebar_wrap', 'custom_welcome_text' );
function custom_welcome_text() {
   genesis_widget_area( 'welcome-text', array(
       'before' => '<div class="welcome-text widget-area">',
   ) );
}

The function that you see above will add the Welcome Text widget to the genesis_before_content_sidebar_wrap hook. As a side note, you can probably use the genesis_after_header hook as well for this.

3. Create Your Welcome Text

Head over to the Appearance > Widgets page in your WordPress dashboard, and you will see that on the right hand side of your screen there is a Welcome Text widget area. Simply add a text widget to that, and write whatever you want your visitors to see.

4. Style Your Welcome Text

Open your child theme’s style.css file, place this code and customize:

/* Welcome Text
------------------------------------------------------------ */

.welcome-text {
    border-bottom: double #ddd;
    border-top: double #ddd;
    font-family: 'Lora', serif;
    font-size: 30px;
    line-height: 1.0;
    overflow: hidden;
    padding: 25px 0;
    text-align: center;
}

.welcome-text p {
    font-size: inherit;
    line-height: 1.0;
    margin: 0;
}

Email Newsletter

Like what you read here in this blog post?
Get more like it delivered to your inbox daily.

Comments

  1. says

    Hi Brian!

    Love your Welcome Text Widget & I am going to implement. Which leads me to the next question, how did you put the About Blog Code Tutorials etc in the black bar? Mine are currently in the left side of what will be this new Welcome Text Widget.
    Thanks!

      • says

        Got it! It looks great but isn’t the same size or font as yours. Did you change the font & size?

        Also, I want to change the Header Setting from Dynamic Text to Image Logo but where do you add the logo so it is attributed with this setting?
        Thanks!!

  2. says

    Thanks Brian. I’ve had an immediate go and like my results. I think I will use this to say something different to my readers every couple of days. Great idea, easy instructions. Cheers!

  3. says

    Hello Brian I wanted to ask you how do you add the Sign up for my Newsletter, to the ending of your post. I have something like that but it will not allow me to add HTML to it…

  4. says

    Implemented.

    I took the liberty of adding a sidebar template loader so I could dispense with the widget and code up what I want displayed from the convenience of localhost with a git push to deploy. Sweet.

    Thanks!

  5. AnitaC says

    I was just getting ready to ask a question when I stumbled on this which will work for me. I want to put two message inside the box – two text boxes. How can I get them to line up side by side?

  6. says

    Brian,
    How would I put some ‘space’ (margin) below it? (It is touching the top of the primary sidebar widget box in the “Streamline” theme).

    Thanks,
    Mark Besh
    Visual Impact Systems

    • says

      Hello David just edit the Welcome text you added to your CSS

      .welcome-text {
      background: #fffffe;
      border-bottom: double #000;
      border-top: double #000;
      font-family: ‘Lora’, serif;
      font-size: 40px; <—–Change it were to see this to any size you like
      line-height: 1.0;
      overflow: hidden;
      padding: 25px 0;
      text-align: center;
      }

      .welcome-text p {
      font-size: inherit;
      line-height: 1.0;
      margin: 0;
      }

  7. says

    Very easy stuff :) .
    I was wondering if you can show us how to add two after post widgets as in Focus. This would come really handy as you could use one for an Add and another one for some cool stuff such us…something else.

  8. cathryn says

    Hi question – this is advertised in the WP.com version of the theme; I am helping someone design her site and she really wants it to look like yours with this Welcome Text Widget. There is a Welcome Text widget on the Wp.com version but I can’t seem to get it to take. Nonetheless, are you saying that this big type ‘welcome’ text widget as you have it on your site can’t be done in WP.com? Thanks.

  9. says

    Brian I can’t see any widget or text that you’re talking about, did you already remove it? If you did, could you amend this post to have a screen shot? I’ve literally spent 15 minutes going through pages and viewing source searching for Starbucks and I have no idea that this post is referring to. Thanks in advance.

  10. says

    Hello Brian looks GREAT as always my friend. I have been working on a few tutorials of self to make things a bit simple. Sorry for the double post…typo

  11. says

    This was just what I was looking for. But how do I put the widget on just the home page of a site?

    I guess it’s a conditional but I don’t know where to put it in the code you shared.

    Thanks.

  12. says

    This doesn’t work with Prose unless you edit the functions.php file, which it says you shouldn’t.

    If you try and edit this in the Custom Code section as recommended, it doesn’t work.

      • says

        Hi Brian,
        With Prose you have to register your widget with the Genesis Simple Sidebar plugin and then put the Add Action in the Custom code area and the CSS in the Custom Css.

        When you register the widget with Simple Sidebars the ID must be welcome-text exactly as in your example.

        It would be great if you could add the condition to the action. I can’t quite figure that syntax so I can have the welcome text widget just on the home page. Prose doesn’t have a home.php like other Genesis child themes.

  13. says

    Hi Brian,
    Haven’t managed to figure it out at all after a couple of hours, diligent copy and pasting and then even reinstalling the theme.

    Very weird.

  14. says

    having a blast learning new things this w/end…simply by following all of your great tuts step by step … this one again worked no hitches.

    Can I experiment with Italic and/or colour of text in the ‘welcome’.

    Also is there a quick tut link you could shoot for ‘possibly’ adding new fonts to the family (eleven40) – cheers

    How was your son’s pitching this w/end ? :) grt shot.

    Regards

    • says

      Hey Eddie,

      The code you need is:

      /** Add the welcome text section */add_action( ‘genesis_before_content_sidebar_wrap’, ‘custom_welcome_text’ );
      function custom_welcome_text() {
      if ( is_home() )
      genesis_widget_area( ‘welcome-text’, array(
      ‘before’ => ”,
      ) );
      }

      • says

        Thanks Brian for the Explanation and Thanks Jon for the code. I was sure that someone here would help me figure this out. My blog is powered by the Eleven 80 theme that comes with the Widget already I needed that modified, now I can make the tweaks for the site to function like the way I want it. Thanks Again.

      • Maria Fernandez says

        Unfortunately the code given by Jon makes my Balance theme blog crash. I’ve tried adding it to functions.php and it breaks. I’ve tried adding it to home.php and it breaks to.

        Is there a way of putting this widget across the top in the Balance theme in the home page only?

  15. says

    Hi Brian, thanks for sharing this code for the welcome text. I copied the code on my site, but I still don’t know how to get the font size for the welcome text to be the same size as it is in the demo for eleven40. Any ideas? Thanks!

      • says

        Ah, thanks Brian! I got it to work. I originally put the words in the title section, but then switched it and put it into the section below it in the widget. I have one last question if that’s ok, in the eleven40 demo, on the left side there is the social media title and links below that (dribble, facebook, google, tumblr, twitter). Is there a plugin for that? Or do I have to write code manually? Thanks!

  16. says

    Hi Brian, I am trying to figure out how to remove the Welcome Text widget from a single page.

    I’m using it to display a portfolio section on each page, but I do not want the widget on the Portfolio page.

    Thanks for your help.
    Chris

    • says

      Just wanted to report that I have a solution to this problem of mine…

      /** Remove Portfolio Widget from Portfolio Page**/
      add_action( ‘get_header’, ‘child_sidebar_logic’ );
      function child_sidebar_logic() {
      if (is_page(1714) ) {
      remove_action( ‘genesis_after_content_sidebar_wrap’, ‘custom_widget_area_name’ );
      }
      }

      - Chris

  17. says

    Hi, this may sound stupid, but i have a theme with a text widget in it already…but to be quite honest…..I don’t really understand the purpose or point of the “text widget” what is it and what is the point of it?

    Thanks

  18. says

    I love how simple you made this. I want to change the widget location to sit above the main content on each page, but not to change the placement of the sidebar. Is that possible? I’m guessing that I just need to change the hook, but I don’t know what to change it to. I’m just starting in WordPress so this is all new to me :)

  19. says

    Hi, I was wondering, is this tutorial outdated? I already have a “Page Title” area on the right-hand-side of my widgets page that does the same thing and is even formatted to look the same.

    I’m pretty sure i didn’t add it in manually, and currently all my plugins are disabled, but it still appears.

    I can see the code block:
    /** Add the page title section */
    add_action( ‘genesis_before_content_sidebar_wrap’, ‘eleven40_page_title’ );
    function eleven40_page_title() {
    genesis_widget_area( ‘page-title’, array(
    ‘before’ => ”,
    ) );
    }

    Just curious, plus the answer to this comment may help others :)

  20. Michael says

    Hi Eddie, Jon or Brian

    Where do I insert the conditional code (for horizontal text on homepage only)?

    As tried functions (led to error), css (nothing changed) and inside the widget (displayed code).

    It’s good to be a rookie ;)

    Thanks, Michael

  21. says

    hey there,

    very nicely explained, and easy to follow, I did all you described but it didn’t work on my genesis child theme ‘magazine’ so I still have a squashed up slider, how can I make this work on ‘magazine? What am I doing wrong?

  22. says

    Thank you for this article, I came across this when I was looking for a conditional code to display on the homepage. Obviously the code I require requires additional elements but looking at this given me a better understanding of what I did wrong. It’s one thing to know how how to copy code, it’s quite another to have an in-depth understanding of how it works.

    This is simply a validation of my wonderful experience with the Genesis Theme Framework. As a UX designer, it really is quite a challenge for me to spread myself too thin. Using Genesis Framework as a leverage to know exactly what is possible, what can be done and what requires more coding gives me a very clean method of modularizing what I can or cannot do. Instead of trying to worry about a simple error in bad code, I can focus on the bigger picture and work my way to further detail. Thank you Brian, I want to start becoming a part of this Framework community.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>