Anyone? Please, I really nedd some help…
This may help, prob have to add some args to make them unique.
Thanks a lot! Now it works!
I replaced the code in my first post with:
index.php
<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar1’) ) : ?>
<?php endif; ?>
page.php
<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar2’) ) : ?>
<?php endif; ?>
functions.php
( function_exists(‘register_sidebar’) )
register_sidebar(array(‘name’=>’sidebar1’,));
register_sidebar(array(‘name’=>’sidebar2’,));
BUT, since my sidebar1.php and sidebar2.php is no longer in use, all my styling disappeared. And now I dont have any div ids/classes to style in my css. So how can I apply my old styling to the sidebars?
Okey. I missunderstood how to do it, and here is the very solution:
STEP 1: functions.php
Register the sidebars in the function.php like this:
( function_exists(‘register_sidebar’) )
register_sidebar(array(‘name’=>’sidebar1’,));
register_sidebar(array(‘name’=>’sidebar2’,));
register_sidebar(array(‘name’=>’sidebar3’,));
STEP 2: index.php / page.php / category.php
Call the sidebar.php (or sidebar2.php if you have more than one sidebar template)
<?php include(“sidebar.php”); ?>
STEP 3: sidebar.php
Create a div and add the widgetized sidebar you want to call with:
<?php if ( !function_exists(‘dynamic_sidebar’)
|| !dynamic_sidebar(‘sidebar1’) ) : ?>
<?php endif; ?>
STEP 4: css file
Style the div where you put the ‘dynamic_sidebar’
Swanson, THANKS A LOT for pointing me in the right direction.
create functions ‘index_sidebar_style’ and ‘page_sidebar_style’, which are just CSS.
Call each as required (CSS should not be in the body – accomplish with if index if page?):
<?php include('index_sidebar_style') ?>
<?php include('page_sidebar_style') ?>
Example:
<?php function page_sidebar_style() { ?>
<style type="text/css">
table {
border: 1px dashed black;
background: #95EAFE;
text-align:left;
width:610px;
}
</style>
<?php } ?>
Might need some tweaking but the basic concept is shown above.