I am using a WordPress theme which has just header and footer. I would like to continue using it by changing the width and adding side bars.
Could anyone help me to change the width (to fit to the screen) of the theme. Does anybody have an idea on how to add sidebars to this theme?
==========
Sorry for not making clear in my earlier question. The theme I am using is Minicard
The lines similar to …
if (function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Sidebar Widgets',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
are already there.
This is the code I found there:
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => __('Beneath the Card (Top)', 'minicard'),
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '<div class="clear"></div></li>',
'before_title' => '<h2 class="section widgettitle">',
'after_title' => '</h2>',
));
register_sidebar(array(
'name' => __('Beneath the Card (Bottom)', 'minicard'),
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '<div class="clear"></div></li>',
'before_title' => '<h2 class="section widgettitle">',
'after_title' => '</h2>',
));
}
So I have created sidebar.php
file and added the code you have given for side bar.
Later I have tried to add the following code:
#sidebar {
width: 240px;
float:right;
padding:0 20px 20px;
}
to CSS.
After making these changes I’ve looked for the sidebar and I havn’t found any additional one.
Generally you can change the width from
style.css
file, which is located in the themes directory ( use firebug to determine the element ).For adding sidebars… use this tutorial.
@user391,
If you want to use sidebar widgets, add the following code to your
functions.php
fileNext you will need to determine the CSS id or class that wraps your main content or posts. Usually this can be found by looking at your
index.php
file right underneath<?php get_header(); ?>
You should see something like
<div id="content">
but it might be named something else. At the bottom of the page look for the closing div ie:</div>
which is usually right before<?php get_footer(); ?>
some themes will close the content divs in footer.php if this is the case you will need to remove it from footer.php and put it right before<?php get_footer(); ?>
Next you need to add
<?php get_sidebar(); ?>
after the closing div and before<?php get_footer(); ?>
and create a new template file named sidebar.phpAdd the following code to sidebar.php
Next you will have to modify your CSS to accommodate the sidebar. Find
#content
or the id or class name you found above and change the width and float it left and add your sidebar we just created above. For example:You might have to adjust the widths depending on the width of the main wrapper div.
You can now add content to the sidebar by using the widgets in your WordPress dashboard.