Looking for an awesome WordPress tutorial? Here's the place to find them! Welcome to our free WordPress tutorial directory.
Template files will include the Sidebar.php file, which most of the time displays both sidebar information and dynamic sidebar information. Basically, when first installing WordPress no widgets will be in action, thus no dynamic sidebar in use. Therefore, whatever is actually listed in the Sidebar.php file will show up on the website.
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
This code is calling into effect the dynamic (widget) sidebar. If there are no widgets in use, then whatever is after this line will display in the sidebar. If you choose to go this route, you can manually call in the functions normally found in the sidebar, such as Categories, Pages, and Archives. Here are those basic tags:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<?php wp_list_categories('arguments'); ?>
<?php wp_list_pages('arguments'); ?>
<?php wp_get_archives('arguments'); ?>
To use this method, navigate to your Theme Editor under the Appearance tab of the dashboard. Select the Sidebar.php file and insert the code as necessary.
What are the benefits of using the basic sidebar functions?
By using the basic commands above and creating specific arguments, you may be able to customise the sidebar a bit more than by just using widgets.
How do I activate the dynamic sidebar?
To activate the dynamic sidebar, you simply go to the Widgets option under the Appearance tab on the left sidebar of the dashboard. Drag whichever widgets you would like to include in the sidebar to the right column and save.
Some widgets give you basic ways to customise, as in the following example:
Some issues arise when template files like to include images to create backgrounds. In this case, you can simply remove the image file and publish a colour to make a one colour background. If you want to get creative, create an image of your own in Photoshop that mimics the design of the original image, but with new colours. Take a look at the template images, which will be included with the template install pack in the images folder.
What are the benefits of using the dynamic sidebar?
The dynamic sidebar is a simple way for WordPress users to manage their sidebar without having to modify code. Many plugins already contain widgets that can you can drag and drop directly to the sidebar. It is that easy.
Can I use both the sidebar and dynamic sidebar?
Yes, actually you can use both options. Basically, the sidebar will also display whatever is included in the Sidebar.php file before this line of code:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
Once the browser hits the above line, it will only show the dynamic sidebar you have created in the Widgets section. So, by putting other commands in front of this line and also activating certain widgets, you can in fact use both options.