How to create widget areas – Advanced users

If you are an advanced user who has a little coding knowledge you can create your custom widget areas by very simple code.

Basically there two steps you need to take:

    • register your custom widget area in functions.php
Here is the code you can use:
<?php $args = array(
	'name'          => sprintf(__('Sidebar %d'), $i ),
	'id'            => 'sidebar-$i',
	'description'   => '',
	'before_widget' => '<li id="%1$s">',
	'after_widget'  => '</li>',
	'before_title'  => '<h2>',
	'after_title'   => '</h2>' ); ?>
<?php register_sidebar( $args ); ?>

 

  • use your already registered custom widget area in a template file
Here is function call example:
<?php dynamic_sidebar( 'Sidebar N' );  ?>

It is not a bad idea to check  if the side bar is active (in use):

<?php if ( is_active_sidebar('Sidebar N') ) { .... }  ?>

 

You might want to try a plugin for creating custom widget areas.

How to create widget areas – no coding required

Combine the dynamic content of widgets with the static content of pages and posts. When you create widget ares in the content of pages and posts you are able to drop widgets in the content area, which makes all widget’s functionality available there.

Creating widget areas by using plugins is very easy. It requires no coding knowledge at all. There are many plugins that you can use. Some of them are free, some of them paid.

Here is a list of recommended plugins. So far they look pretty fine and working correctly. Although we can not guarantee they are working 100% since they are 3rd party.

Most of the plugins will create widget areas for you. Other plugins will provide you with shortcodes that you can place in a page or post. Then you can go go your widgets section (Appearance -> Widgets), find the widget areas created by the plugin and start dragging widgets in.

If you are an advanced user you can code custom widget areas yourself.

Portfolio Project 3

 

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elementum, nunc tincidunt congue adipiscing, eros magna mollis nisi, ut cursus nunc purus vitae ligula. Cras quis urna ut massa bibendum bibendum. Quisque condimentum augue at erat lobortis sed mollis erat tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam erat volutpat. Nullam dui justo, rutrum quis sodales vitae, aliquet eu ante. Curabitur lorem mauris, ornare in malesuada id, ornare ut nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

Portfolio Project 2

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elementum, nunc tincidunt congue adipiscing, eros magna mollis nisi, ut cursus nunc purus vitae ligula. Cras quis urna ut massa bibendum bibendum. Quisque condimentum augue at erat lobortis sed mollis erat tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam erat volutpat. Nullam dui justo, rutrum quis sodales vitae, aliquet eu ante. Curabitur lorem mauris, ornare in malesuada id, ornare ut nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

Portfolio Project 1

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elementum, nunc tincidunt congue adipiscing, eros magna mollis nisi, ut cursus nunc purus vitae ligula. Cras quis urna ut massa bibendum bibendum. Quisque condimentum augue at erat lobortis sed mollis erat tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam erat volutpat. Nullam dui justo, rutrum quis sodales vitae, aliquet eu ante. Curabitur lorem mauris, ornare in malesuada id, ornare ut nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

Product 3

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elementum, nunc tincidunt congue adipiscing, eros magna mollis nisi, ut cursus nunc purus vitae ligula. Cras quis urna ut massa bibendum bibendum. Quisque condimentum augue at erat lobortis sed mollis erat tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam erat volutpat. Nullam dui justo, rutrum quis sodales vitae, aliquet eu ante. Curabitur lorem mauris, ornare in malesuada id, ornare ut nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

Product 2

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elementum, nunc tincidunt congue adipiscing, eros magna mollis nisi, ut cursus nunc purus vitae ligula. Cras quis urna ut massa bibendum bibendum. Quisque condimentum augue at erat lobortis sed mollis erat tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam erat volutpat. Nullam dui justo, rutrum quis sodales vitae, aliquet eu ante. Curabitur lorem mauris, ornare in malesuada id, ornare ut nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

Product 1

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elementum, nunc tincidunt congue adipiscing, eros magna mollis nisi, ut cursus nunc purus vitae ligula. Cras quis urna ut massa bibendum bibendum. Quisque condimentum augue at erat lobortis sed mollis erat tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam erat volutpat. Nullam dui justo, rutrum quis sodales vitae, aliquet eu ante. Curabitur lorem mauris, ornare in malesuada id, ornare ut nisl. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

Paint brush

They were hard at work there far into the night, and the towering pillar of dense green smoke that rose therefrom could be seen from the hills about Merrow, and even, it is said, from Banstead and Epsom Downs. And while the Martians behind me were thus preparing for their next sally, and in front of me Humanity gathered for the battle, I made my way with infinite pains and labour from the fire and smoke of burning Weybridge towards London. I saw an abandoned boat, very small and remote, drifting down-stream; and throwing off the most of my sodden clothes, I went after it, gained it, and so escaped out of that destruction. There were no oars in the boat, but I contrived to paddle, as well as my parboiled hands would allow, down the river towards Halliford and Walton, going very tediously and continually looking behind me, as you may well understand. I followed the river, because I considered that the water gave me my best chance of escape should these giants return. The hot water from the Martian’s overthrow drifted downstream with me, so that for the best part of a mile I could see little of either bank. Once, however, I made out a string of black figures hurrying across the meadows from the direction of Weybridge. Halliford, it seemed, was deserted, and several of the houses facing the river were on fire. It was strange to see the place quite tranquil, quite desolate under the hot blue sky, with the smoke and little threads of flame going straight up into the heat of the afternoon. Never before had I seen houses burning without the accompaniment of an obstructive crowd. A little farther on the dry reeds up the bank were smoking and glowing, and a line of fire inland was marching steadily across a late field of hay. For a long time I drifted, so painful and weary was I after the violence I had been through, and so intense the heat upon the water. Then my fears got the better of me again, and I resumed my paddling. The sun scorched my bare back. At last, as the bridge at Walton was coming into sight round the bend, my fever and faintness overcame my fears, and I landed on the Middlesex bank and lay down, deadly sick, amid the long grass.

Many colors

It would seem that these giants spent the earlier part of the afternoon in going to and fro, transferring everything from the second and third cylinders–the second in Addlestone Golf Links and the third at Pyrford–to their original pit on Horsell Common. Over that, above the blackened heather and ruined buildings that stretched far and wide, stood one as sentinel, while the rest abandoned their vast fighting-machines and descended into the pit. They were hard at work there far into the night, and the towering pillar of dense green smoke that rose therefrom could be seen from the hills about Merrow, and even, it is said, from Banstead and Epsom Downs. And while the Martians behind me were thus preparing for their next sally, and in front of me Humanity gathered for the battle, I made my way with infinite pains and labour from the fire and smoke of burning Weybridge towards London. I saw an abandoned boat, very small and remote, drifting down-stream; and throwing off the most of my sodden clothes, I went after it, gained it, and so escaped out of that destruction. There were no oars in the boat, but I contrived to paddle, as well as my parboiled hands would allow, down the river towards Halliford and Walton, going very tediously and continually looking behind me, as you may well understand. I followed the river, because I considered that the water gave me my best chance of escape should these giants return. The hot water from the Martian’s overthrow drifted downstream with me, so that for the best part of a mile I could see little of either bank. Once, however, I made out a string of black figures hurrying across the meadows from the direction of Weybridge. Halliford, it seemed, was deserted, and several of the houses facing the river were on fire. It was strange to see the place quite tranquil, quite desolate under the hot blue sky, with the smoke and little threads of flame going straight up into the heat of the afternoon. Never before had I seen houses burning without the accompaniment of an obstructive crowd. A little farther on the dry reeds up the bank were smoking and glowing, and a line of fire inland was marching steadily across a late field of hay. For a long time I drifted, so painful and weary was I after the violence I had been through, and so intense the heat upon the water. Then my fears got the better of me again, and I resumed my paddling. The sun scorched my bare back. At last, as the bridge at Walton was coming into sight round the bend, my fever and faintness overcame my fears, and I landed on the Middlesex bank and lay down, deadly sick, amid the long grass. I suppose the time was then about four or five o’clock. I got up presently, walked perhaps half a mile without meeting a soul, and then lay down again in the shadow of a hedge. I seem to remember talking, wanderingly, to myself during that last spurt.