Hi all,
below is my second post, I hope you enjoy it. This will help you place banners all over your site, I’m no pro and I can do it. THAT MEANS YOU CAN TO
As you can see from my site, there are banners all over the place. Previously, I only had one sidebar and that was hell. Please visit this link to see how to associate your banners with your zones and then use them as a widget.
How to Widgetize your theme
Please follow the following steps:
- Go to Design, then to Theme Editor
- Clicks on functions.php which would be labeled as Theme Functions
- There will most probably be something like the following in that file
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<li>',
'after_widget' => '</li>',
'before_title' => '<h2>',
'after_title' => '</h2>',
));- I added the following to create a few extra widgets, please see image below.
register_sidebar(array(
'name' => 'Sidebar 2',
'before_widget' => '<li>',
'after_widget' => '</li>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'Sidebar 3',
'before_widget' => '<li>',
'after_widget' => '</li>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'Top of Blog',
'before_widget' => '<li>',
'after_widget' => '</li>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
Now you save the file. Please be careful when doing this as if something is wrong then your screen will go blank. I normally just edit the file via some text editor and then upload it to my server. I had many problems trying to figure this out, I have to admit that my screen went blank many times.
- Go to Design, then to Widgets
The next picture shows you the widgets that I just created. From the drop down menu, you can see there are a few widgets. Yours new widgets should show up here, if not then something is wrong with your functions.php file.
- Now add your plugins to your widget
- Click on Save
- Repeat process for other widgets
- Go to Design, then to Theme Editor
- Select your header.php file or another file
- Enter the following code to display your widget, this widget would show me the banners on top of my blog (468×60)
<?php /* Widgetized sidebar, if you have the plugin installed. */
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(4) ) : ?>
<?php endif; ?>
When you create the widgets in the functions.php file, they are numbered. These numbers relate to how they are listed when adding plugins to your widgets and it is also used to display the widget.
| Widgets in functions.php file | Number to use in code |
| Sidebar 1 | 1 |
| Sidebar2 | 2 |
| Sidebar3 | 3 |
| Top of Blog | 4 |
| Footer Left | 5 |
| Footer Center | 6 |
| Footer Right | 7 |
- Click Save and check your site.
Below is a picture of mine where it shows the 468×60 banner. This process must be repeated to show your widgets. You can edit the footer, post, page, etc. The choice is yours.
Once you have added more widgets to your them, you can use these widgets for any plugin you desire which is installed on your server.
Let me know if this helped!
I am the proud owner of Serradinho.com and have made this my second home. I'm into blogging, downloads, WordPress, meeting and helping others, etc. Basically the internet in general :) Serradinho Web Services is my own company whereby I offer my services to clients. This ranges from web design, website upgrades, theme customizations, support, premium WordPress plugins and many more .....
View all posts by George Serradinho, there might be other posts that interest you.











{ 1 comment }
Hi,
thanks for the info.
You have made my day :laughman:
Comments on this entry are closed.