Tutorials

Creating a Widget Ready Footer on WordPress

Although WordPress is a superb platform in itself, learning a few simple tricks and hacks is always welcome. For instance, your WordPress theme becomes all the more versatile with a widget ready footer. This is how you do it. Open the functions.php file and brace yourself for some coding exercises. Locate this code fragment.

if ( function_exists(\’register_sidebar\’) ){ register_sidebar(array( \’before_widget\’ => \’\’, \’after_widget\’ => \’\’, \’before_title\’ => \'<h2>\’, \’after_title\’ => \'</h2>\’, ));

You do not need to create any code; you\’ve just got to copy and paste the following code after the above snippet in the functions.php file.

register_sidebar(array( \’name\’ => \’footer-widget\’, \’before_widget\’ => \'<div id=\”%1$s\”>\’, \’after_widget\’ => \'</div>\’, \’before_title\’ => \'<h3>\’, \’after_title\’ => \'</h3>\’ ));

The following points would give you a clearer picture of what exactly has been done through the code.

Name: The name of the widget is pretty obviously footer. The thing to take note of here is that the same code can be repeated inside the function to have another footer widget area on the page.

Description: Short and crisp description that gets displayed in the admin panel.

Before_widget: When you want to place the widget inside an html code such as <div>, you use this part of the code, although we have left this blank in our example.

After_title: In the example, we did not want to wrap the title in any html, so this was set to false. Once you are done with the code pasting part in the functions.php file, you have to open the footer.php document and use the following code in there.

<div id=\”footer-widget&quot;\”><?php if ( !function_exists(\’dynamic_sidebar\’) !dynamic_sidebar(\’footer-widget\’) ) : ?>

<?php endif; ?>

</div>

This way, you are allowing widgets to be applied in footers. Now, save the documents and log in to your Dashboard. You\’ll see your widget ready footers there. Thus, the task of creating a widget ready footer in WordPress is not difficult at all, and since you get readymade code, you face absolutely no coding blues while doing so.

Creating a Widget Ready Footer on WordPress

Leave a Comment

four × 2 =

Hurry Up !!!

BIG Discounts &
Great Savings on

Popular WordPress Themes of Top Developers
GET IT NOW
* Terms & Conditions Apply
close-link