Paid Forum Posts

Get excellent content for your forum or earn money as a paid forum poster.

Free Forum Admin Book

Learn how to start your community and make it a success. FREE download.
  1. Admin Forum - for blog and forum owners

    Do you run a blog? A forum? Read useful forum and blogging articles, find out the secret of creating a TOP community. Registration is FREE!
  2. Advertising, domain names and more ..

    Each of your posts/threads earns you points. Use these to redeem advertising plans on this forum or get REAL domain names and cpanel hosting accounts to use for your sites.

  3. Do you have a brand new forum?

    If you do, then you need members and posts to kick start it. Join our Forum Starters program and get members and posts for your brand new forums

  4. Make Money Online

    Are you a good forum / blog theme designer? An experienced content provider? Post the jobs you can provide, set your price and have clients hire and pay you. NO commission free job marketplace.

How to add widget locations to wordpress themes.

Discussion in 'Blog Advice and Articles' started by dmchenry, Aug 2, 2012.

  1. dmchenry Just joined

    Message Count:
    42
    Money:
    148
    Widgets are part of the reason wordpress is so great. I've found that you can never have to many widget locations, and with some more advanced coding you can have customized widgets for each page or category in your blog. I originally wrote this article for my blog but figured I'd share it here too. The example I give will let you put a widget in your wordpress header

    The first thing we need to do is register our new widget location. This is done by editing your themesfunctions.php file (or a custom-functions.php file if your theme supports it). In your wordpress administration area go to Appearance -> Editor. Then find the functions.php file over on the right, and add the following code:

    Be sure you either add this at the very end of the functions.php file before the closing PHP tags, or at the very beginning after the opening PHP tags.

    Code:
    register_sidebar(array(
      'name' => 'Header',
      'id' => 'header',
      'before_widget' => '',
      'after_widget' => '',
      'before_title' => '<h3>',
      'after_title' => '</h3>'
    ));
    
    This is a PHP function that will register the widget location to show up under the Appearance -> Widgets locations.

    The ‘name’ field can be anything you want, but should be descriptive as this is what appears under your widgets menu. The ‘id’ must be unique and not contain any spaces. The ‘before_widget’ and ‘after_widget’ lets you insert any HTML code you want to display. The ‘before_title’ and ‘after_title’ lets you style the widget title.

    The final step is to open your header.php file for editing and adding the following code to where you want your widget to appear.

    Code:
    <?php  dynamic_sidebar('header');  ?>
    
    And that’s it! You’ve now got a widget in your WordPress header. This will make swapping blocks of content in and out easier for you.
  2. aadryanaa Level 4

    Message Count:
    466
    Money:
    1,040
    This is awesome! I've been looking for something like that for quite some time :) I wanted to add something in the header because the header design I made is not that good looking and so I decided to add something nice there instead. Thank you very much for sharing this with us :) Great tutorial!
  3. Victor Leigh Level 10

    Message Count:
    1,015
    Money:
    486
    This is good information. However, like I mentioned somewhere else, I never write code when I can copy it. So what I do is use the Suffussion theme and I can add more widgets than I need. Including a few in the header, above the header and below the header.
  4. aadryanaa Level 4

    Message Count:
    466
    Money:
    1,040
    There always are more widgets than you need :) If I used them all my website would be infinitely long and you'd have to scroll down for hours to find the footer :D
  5. Roach Level 18

    Message Count:
    1,849
    Money:
    2,832
    This is a good informational article and I am glad to see you contributing to writing articles for Top Admin. A good guide and I will be sure to use it if I need it.
  6. Victor Leigh Level 10

    Message Count:
    1,015
    Money:
    486
    Just thought of something. How about some screen shots so that we can actually see how it looks like on the Wordpress page? I, for one, am not good at visualizing some things.
  7. LunarScorpio Level 3

    Message Count:
    398
    Money:
    1,027
    This is great information! I was wondering how to go about doing this if/when I decided I needed more space for widgets; though, right now I think I'm good with the amount I have. Thanks for this, it'll come in handy!
  8. dojo Administrator

    Message Count:
    2,959
    Money:
    7,164
    Please use your signature to promote your site, not the post area. The tutorial is OK, the only problem is that now functions.php comes with multiple sidebars set. It's good though to understand the process of widgetizing the sidebars. :)
  9. dmchenry Just joined

    Message Count:
    42
    Money:
    148
    Not a problem, Is there any way to edit the first post, I'd like to add a little more detail and screenshots?
  10. Geoffrey Senior Member Lv. 1

    Message Count:
    2,376
    Money:
    4,828
    You can only edit your post within a few minutes (60 I believe) of making the post, so no, you can't edit it. Sorry. :(

Share This Page