Thesis Tutorial: Sidebars However You Like Them

May 25, 2009 · Comments

in Articles, Internet, Technology, Tutorial

thesis-binary

One of the things I learned from creating multiple custom page templates within the Thesis framework was how to create and modify sidebars. WordPress and Thesis provide you with a simple an effective way for implementing sidebars on your website with the use of simple syntax, options, and widgets. However beyond the basics you may have the need or desire to have different sidebar options for different types of pages.

Depending on how you’ve setup and defined your website, you may want specific items to appear in sidebars for different pages. You may want a sidebar that doesn’t contain anything the default sidebars display. The way Thesis and WordPress work “out of the box” limits your options because you only have 2 sidebars.

With this tutorial your sidebar options are limitless and the boundaries are defined by your needs.

Before I go much further if you are really new to using Thesis and customizing it you should read my little primer from my first Thesis tutorial before going further.

The Table of Contents If You Please

I will explain how to do the following:

  1. Define and implement your basic, baseline sidebar(s)
  2. Define and implement a custom sidebar for a specifc page or pages to show instead of the default sidebar(s)
  3. Define and implement a custom sidebar to show with any default sidebar

Between these three options you WILL be able to mix-and-match and create sidebar options that will work for your needs. If you plan ahead, think it through, code, test, code, test and test again you will get it to work.

Here we go.

Basic Sidebars

Once you have Thesis installed you will want to proceed to the Design Options it offers you. It is here that you will define the basic, or core, page layout that all pages and posts will inherit. Anything NOT customized inside of custom_functions.php or custom.css will take on the layout you define in this area.

Once you have logged into your admin area you will want to go to the left-hand sidebar to Appearance/Design Options. Once the page has loaded you should see Site Layout options in the second column as seen here:

picture-4

  • You need to first select the type of layout that you would like to use—be it 1, 2, or 3 columns.
  • Once you have selected a 2 or 3 column option in the pull down menu, you immediately will be presented with options.
  • You will need to enter a width for your content column and specify a column order for your baseline design in the panel pictured here…

picture-5

That’s all that is needed to activate and “install” your basic, default sidebars. This gives you a baseline to work from.

Next we will talk about custom sidebars.

Testing for Specific Pages and Inserting Sidebars

What if you want a custom sidebar, or you have a custom page template and want the standard sidebars? You may want specific content in a sidebar on a specific page, sets of pages, or specific categories in addition, or instead of the default sidebars.

If this is the case then here is the deal.

You will need to open up the file custom_functions.php file that resides here:

~/wp-content/themes/thesis/custom/

You are going to write a function that tests for the page or category, pulls in your content, and renders your sidebar how you like it.

You need to:

  1. name your function
  2. test to see if the page or category matches the criteria
  3. if so, then render the page/category content
  4. THEN render your custom sidebar(s)

You can see an example here where I test for a page with the name “press” which also has a page ID of “512″

/* CUSTOM SIDEBAR TEMPLATE */

function custom_sidebar_01() {
if (is_page('press') || is_page('512')) { ?>

<div id="content">
<div class="post_box">
<div class="headline_area">
	<h2>Your Headline</h2>
</div>
...This is where your content goes...
</div>
</div>
<div id="sidebars">
<?php thesis_build_sidebars(); ?>
</div>		

<?php } }

remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'custom_sidebar_01');

There is a call in the code above:

<?php thesis_build_sidebars(); ?>

This php line above is what builds the default sidebars you setup in the first part of this tutorial.

Any Combination of Sidebars

What if you want…

  • one of the default sidebars to show with a custom sidebar?
  • a custom sidebar with no default sidebars?
  • define any number of custom sidebars for any number of custom pages or categories?

There are two key things you will need to accomplish any of the above:

  1. Define a custom sidebar in custom_functions.php
  2. A plugin that allows you to use widgets in more than one sidebar

Defining a custom sidebar in custom_functions.php

I will admit that I did not create the following masterful stroke of coding. The kudos for that goes to Kristarella. I was in the DIYThemes forums working on helping with some custom page templates and the question came up about adding additional sidebars. Kristarella jumped in and provided some help.

To create a third, fourth, fifth sidebar (you can create as many as you like using this coding) you need to first register the sidebar. Be sure you are working inside of custom_functions.php

/* CUSTOM SIDEBARS */

register_sidebars(1,
    array(
        'name' => 'Sidebar 3',
        'before_widget' => '<li class="widget %2$s" id="%1$s">',
        'after_widget' => '</li>',
        'before_title' => '<h3>',
        'after_title' => '</h3>'
    )
);

You can repeat the above code replacing “Sidebar 3″ with “Sidebar 4″ etc.

Once you have defined the sidebar(s), the next step is to implement it in a page, category, or post. To create a custom function that tests for a specific page, category, or post I recommend checking out my previous tutorial Multiple Custom Page Templates.

You should plan out exactly what you are after before fussing with code.  For the sake of this tutorial I have coded my custom_functions.php file to display a custom sidebar 3 which contains a specific comment, a yellow background, and calendar. The new custom sidebar 4 which contains aspecific comment and twitter comments.

You can tell if I have done this correctly by looking at the sidebar on this test page. The sidebars will be different from every other page on this website. Coolness.

The full function to test and implement custom sidebars

I first defined the third sidebar as the code above suggests. Next I created a function that tests for this specific page inside of custom_functions.php.

In the function I created I call for the page content, and call for the custom sidebars I defined previously, sidebar 3, and a new custom sidebar 4. Then I make the call for the custom template to be implemented.

/* TEST FOR SPECIFIC PAGE FOR SIDEBAR TUTORIAL */

function custom_sidebar_01() {
if (is_page('sidebar-3')) { ?>
<div id="content">
<div class="post_box">
<div class="headline_area">
	<?php the_title('<h1>', '</h1>'); ?>
</div>
<?php if (have_posts()) : ?>
	<?php while (have_posts()) : the_post(); ?>
			<div class="format_text">
				<?php the_content( ); ?>
			</div>
<?php endwhile; ?>
<?php else : ?>
	<h2>Not Found</h2>
	<p>Sorry, but you are looking for something that isn't here.</p>
	<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php endif; ?>
</div>
</div>
<div id="sidebars">
<div id="show-only-3-and-4">
<?php sidebar_3(); ?>
<?php sidebar_4(); ?>
</div>
</div>
<?php } }
remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'custom_sidebar_01');

Once the sidebars are working you will need to setup styling to make the sidebars have the proper width and floats to get the sidebars to behave in your layouts. In my case this is the CSS I used to get the results on this page.

div#sidebar_3.sidebar, div#sidebar_4.sidebar {
	width: 217px;
}

div#sidebar_3.sidebar {
	float: left;
	background-color: yellow;
}

div#sidebar_4.sidebar {
	float: left;
	background-color: silver;
}

A custom sidebar with a standard sidebar

In order to have one of the default sidebars show up with one of your custom sidebars you only need to change what sidebars you are calling. For example in the following snippet of code you can see how to do it by calling for the custom sidebar 3 and the default sidebar 1. To call the second sidebar you would change the number 1 to number 2.

<div id="sidebars">
<?php sidebar_3(); ?>
<?php thesis_sidebar_1(); ?>
</div>

What about that plugin?

There is a plugin I used in combination of creating the custom sidebars because in the current model of WordPress default behavior is that you can only use a widget once in all sidebars. So, I use a plugin called “Widgets Reloaded” that allows me to reuse a core set of widgets across all sidebars. Take a look and give it a go.

Wrap Up

From the outlined code above you may see how it is now possible to create as many custom templates as you like and get the look and function you are after. Hopefully this tutorial will get you started on the right track.

Hope this helps you.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Twitter
  • StumbleUpon
  • Technorati
  • Facebook
  • Google Bookmarks
  • NewsVine

Do you need help with Wordpress, or the Thesis theme?

Image of DoubleMule certification. I'm a Thesis Certified Designer.

If you are a web designer or web developer needing help, or a 'do-it-yourselfer' looking for a professional Internet presence I can help.

If you need help with a specific WordPress or Thesis theme issue or a complete website, I offer consultation, complete web design, and web development services.

Get in touch and we can talk about your needs and start the process.

  • Storm
    Really useful tutorials, thanks!!!

    I am new to Thesis and working on my 1st blog. What I'd like to do is use a background gradient image(sidebargradient.jpg) for the sidebar. Not sure what code I need to do this and there will need to be something to tell it to stretch the image, obviously, with sidebars being dynamic.

    I'm guessing I have to input code in both the custom.css and custom.functions.php files. Any help would be greatly appreciated, I'm working on a standard 2 column theme(right sidebar).

    Thanks
  • Wendy
    Hi,

    I am trying to widgetized the home page's middle content area. I have tried to replace the footer hook to a "before content hook" and screwed up my custom_functions.php file. Any suggestions would be helpful.

    Thanks,
  • thanks for the custom sidebar..! great tutorial..! really helpful!
  • Thank you for such a amazing piece of information. I am new to wordpress and thesis. I had gone through so many websites to customize my sidebars but I'm telling you non of those articles are not even close to you. Kudos my friend. Regards, VJ.
  • Claudia
    Hi

    I am using a one collum layout for my thesis theme and at the bottom I have sidebar 1 and sidebar 2, do you maybe know how I can make that into one big sidebar instead?

    Thank you so much

    Claudia
    The netherlands
  • You could put all your 'widgets' into one sidebar, then make the change in Thesis design options to have a 2 column layout with one sidebar.
  • DJMorrisFitness
    What if you want your site to have sidebars on all posts and the homepage, but not on any Pages?....Is that easy to set-up that way?
  • Sure you could create a conditional that tests for "any page that is NOT the home page" then supply the needed custom template.
  • normfields
    I'm trying to create a custom sidebar layout for specific post categories, rather than pages. For example, I want to display video posts with no sidebars to allow the videos to fill the entire width of page. I have found some code that claims to do it but it crashes the other pages.
  • You should be able to create a conditional that tests for a specific category then deliver the custom template you want. You may need to do this with the category ID.
  • Hi, Thank you for the useful tutorials. I messed up a little.
    I need to disable sidebars from the home page only. Is there any custom hook we can use to disable sidebars.
  • You can use the 'no sidebars' option in the custom menu dropdown.
  • Gus
    I just starting with thesis but i like it more every sec! :)
  • I am currently reviewing wordpress, use at this moment xsitepro to develop my websites.

    Seems like wordpress or thesis is great also for developing static websites just have to get around the coding issues when looking to modify what thesis cannot do, just the same with xsitepro.

    What are your rates for consultation and simple tweaks, forward me your rates.
  • Edwin, Drop me a note using my form and I will be in touch: http://bit.ly/bujJJK
  • MaryAnnEpstein
    Do you have a video tutorial for this? or Do you know of one? I think I need to be talked through it, not have to read it.

    :)

    Mary Ann
  • I am now exploring the use of video on the tutorials. I know different people learn different ways so this is on my radar.
  • MaryAnnEpstein
    Great tutorial but a little over my head. Or maybe I am just having a mental block about it.

    I need to make a page with two side bars totally different from the original side bars. I like choosing the no sidebar template, is there an easy place to get a template like that with page with sidebar 3 and 4.

    I know that once I do this the first time, I can use it in many ways.

    Help!!
  • You should refer back to the subtitle "The full function to test and implement custom sidebars" In that example you will see that I am using Sidebar 3 and Sidebar 4 in that page template. You could copy/paste that and have Sidebar 5/6/7/8, etc. You can make as many as your project needs.
  • Hi,

    I really would like to give acces to my blog (www.bloggingthenews.info ) to other authors than myself. But I don't have time and money to switch it to a Wordpress MU install.
    You show here that Thesis Theme allows to create multiple sidebars and assign sidebars to post/category/page .

    But, my point is to assign 2 custom sidebars/by Author (so if I have 20 authors on my blog, there will be 40 sidebars + the 2 general sidebars of the homepage)

    I'v installed the openhook plugin and, so far, it works pretty well

    Do you think it's possible ? Can you help me a bit (I'm a journalist, not a coder :-)
  • Hi Damien, with the right code syntax I think it is possible. In terms of helping fill out my contact form on the site with as much detail as possible. Hope this helps.
  • paynemike
    Great post, Bert!

    Question for you: How can I have most of my website utilize a custom sidebar while the BLOG part of my website defaults to THESIS sidebar (i.e. multi-media box, widgets, etc)?

    My real estate site is http://www.sarasotahomesforsalenow.com

    I'd like the "MY BLOG" part of my site to be controlled by THESIS design options (if possible) or at least through custom_functions (if necessary).

    Thanks, Bert.
  • Hi Mike,
    You need to build some custom sidebars then build a custom page
    template that uses those custom sidebars. You can see how to do the
    custom page tutorial on my site here:

    http://www.berchman.com/thesis-tutorial-multipl...

    Hope this helps.
  • thanks ... i am a newbie to thesis theme ... this is helpful :)
  • You are welcome.
  • I was looking at Copyblogger's site where he has the 2 sidebars shown throughout his blog, but on specific pages his sidebars were removed.

    Was that done using the same method as shown here?
  • Hi Berchman,

    It still don't work for me:

    here is my code

    /* CUSTOM SIDEBARS */

    register_sidebars(1,
    array(
    'name'=>'Sidebar 3',
    'before_widget'=>'<li class="widget %2$s" id="%1$s">',
    'after_widget'=>'</li>',
    'before_title'=>'

    ',
    'after_title'=>'

    '
    )
    );
    /* TEST FOR SPECIFIC PAGE FOR SIDEBAR TUTORIAL */

    function custom_sidebar_01() {
    if (is_page('test')) { ?>
    <div id="content">
    <div class="post_box">
    <div class="headline_area">
    <?php the_title('

    ', '

    '); ?>
    </div>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="format_text">
    <?php the_content( ); ?>
    </div>
    <?php endwhile; ?>
    <?php else : ?>

    Not Found


    Sorry, but you are looking for something that isn't here.


    <?php include (TEMPLATEPATH . "/searchform.php"); ?>
    <?php endif; ?>
    </div>
    </div>
    <div id="sidebars">
    <div id="show-only-3-and-4">
    <?php sidebar_3(); ?>
    <?php sidebar_4(); ?>
    </div>
    </div>
    <?php } }
    remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
    add_action('thesis_hook_custom_template', 'custom_sidebar_01');

    Maybe this helps to see my problem

    Thx mate

    Greetings from belgium
  • Susan
    I'm having the same problem as Mike, above. Using the code in the same way, in custom_functions.php. It's reading the custom template, but the page code stops at <div id="show-only-3-and-4"> and I get a PHP fatal error: Call to undefined function sidebar_3() in /wp-content/themes/thesis_16b/custom/custom_functions.php on line 90. I've checked and rechecked my code against yours, looked at all the pages and tutorials you reference and just can't get it to work.
  • Hi Susan,
    I would check the names of each of your functions and calls to them.
    Typically there is something not matching properly when you see these
    errors.
    Hope this helps.
  • andimac
    I have managed to get the function created like you have in your test page... and added the "register" code in custom_functions.php... but the widgets I add in the admin widgets manager don't show up. What have I done wrong? - Andi
  • I'm having the same issue, Andi (and my name is also Andi -too funny). Everything is working but my sidebars are not showing.

    I know Wordpress so well and Thesis is like learning a new language!
  • jennybuttler
    Question....
    I know that this is possible to do with static pages, but is it possible to do this on category pages. I have some premade templates for wordpress, blogger, etc. that I sell, I am currently on blogspot transferring over to Wordpress and have deciced upon thesis. However, I am a complete nin-com-poop when it comes to this whole hook thing. I would like some sidebars to have certain widgets displayed on certain category pages??? possible, no?
  • Indeed. You could build a function that tests for certain categories, and if the result is positive render the custom layout you would like. Sounds like I need to do another tut. :-) Let me know if you have questions.
  • Hi Berchman,

    This tutorial seems great but i cant see sidebar 3 in my php code on my testscreen, so it doesnt show on that page?

    It's like:
    register_sidebars(1,
    array(
    'name' => 'Sidebar 3',
    'before_widget' => '<li class="widget %2$s" id="%1$s">',
    'after_widget' => '</li>',
    'before_title' => '

    ',
    'after_title' => '

    '
    )
    );

    doesn't work for me.

    This is the page where normal sidebar 3 must come
    The link is http://www.mikevsnet.be/?page_id=146

    Where did i go wrong?

    Thx

    Ps: do you also css for IE6(not for free ofcours)?
  • Hi Mike,
    I cannot see all the code you posted. Perhpaps it was stripped out in
    posting.
    Here is the code you need. I have put spaced in the tags so that the
    code stays in tact. Be sure to remove them:

    / * CUSTOM SIDEBARS * /

    register_sidebars(1,
    array(
    'name' => 'Sidebar 3',
    'before_widget' => '< li class="widget %2$s" id="%1$s" >',
    'after_widget' => '< / li >',
    'before_title' => '< h3 >',
    'after_title' => '< / h3 >'
    )
    );

    Hope this helps.
  • Hi Berchman,

    I don't know what spaced in the tags mean?
    What part do i have to remove?

    sorry for my english

    thx
  • Hi Mike,
    No problem.
    There are spaces between the < and the > of all the tags. This is so
    the website does not 'process' them and make them disappear.
  • Hey Bercham, thanks so much for taking the time to write and share this tutorial with us. I am learning Thesis for a client and have a quick question. (I am still waiting for the login from the client to the Thesis support forums, otherwise I would post there as well).

    I simply want to display 3 column layout on the home page and keep the 2 column layout on all other pages. How can I call an addition default side bar? I can hide the sidebars with CSS, but dont want to write custom.css for all pages. Any quick simple ideas? Thanks so much in advance for your time.

    All the best,
    Jayson

    PS: I am a pretty savvy WP developer/designer, love to stay in touch.
  • Following up on Ilya I believe it depends on your layout.

    column, content, column
    or
    content, column, column, etc.

    This, I think will help you determine the best approach (i'm guessing
    that one line of css will do the trick depending on your layout).
    Let me know if you have any questions.
  • ilya
    I wanted to achieve something similar. I achieved as follows:
    - use thesis to calculate and render the 3 columns. Copy the CSS code.
    - use thesis to settle on the 2 column layout
    - use open-hook to add a wrapper around the content so CSS knows it is the homepage, and tweak the css for the homepage "exception".

    hope this helps...
  • An extremely helpful instruction. It took me awhile, because I was getting hung up on a call error that basically said I was calling a function that didn't exist.

    What I needed to do was use:

    <?php dynamic_sidebar(sidebar_3); ?>

    Instead of:

    <?php sidebar_3(); ?>

    That fixed everything for me...
  • ilya
    All right, i succeeded what I wanted to do. And because this tutorial helped me achieve it I will share what I have done with you.

    I wanted a thesis two column layout, with the Sidebar on the right.
    On my "pages" I wanted a three column layout, with subnavigation on a sidebar to the left of the content column.

    How did I achieve that? :

    I started out playing around with a three column layout. Jotting down the values from layout.css

    I then reverted the main layout to the two column layout, with the values that I needed.

    Then I created the custom template, as in this tutorial.

    Except I did not create a "third" sidebar, simply used as much of the thesis framework in place.

    So this is my custom page template function:

    function custom_page_with_navigation() {
    if (is_page()) {
    echo ' <div id="column_wrap">';
    thesis_content_column();
    thesis_get_sidebar(2);
    echo ' </div>';

    echo ' <div id="sidebars">';
    thesis_hook_before_sidebars();
    if (thesis_show_multimedia_box())
    thesis_multimedia_box();

    thesis_get_sidebar(1);

    thesis_hook_after_sidebars();
    echo ' </div>';
    } }

    I had to dig around a little in the thesis files. Basically I copied the functionality from
    thesis_wrap_columns() in lib/content_box.php
    thesis_sidebars in lib/sidebars.php
    thesis_build_sidebars in lib/sidebars.php

    Now all I had to do was to add the stylesheet information to get it to display properly:

    custom.css to the rescue

    first I had to mention there is a column_wrap div coming, with a certain width:
    .custom #column_wrap { width: 74.1em;}

    Then I had to mention that the content div needs to be smaller and float to the right. But only when it is inside a columnwrap, otherwise it would do it on every page...

    .custom #column_wrap #content { width: 55em; float: right; }

    Finally just mention that there is also a sidebar_2:

    .custom #sidebar_2 { width: 19em; border: 0; float: left; }

    And that is it..

    Of course this is not really usefull when you have all kinds of templates, but then one is probably better off with multiple template files, but then one has to duplicate more thesis framework functions. I would hope a future release has even more custom templating options...

    anyway, just thought I would share this. feel free to wrap this in a new tutorial if you feel this comment is too long :)
  • Great to hear that you succeeded.
  • ilya
    Hi,

    I followed this tutorial to the T, but when php reaches the line: <?php sidebar_3(); ?>

    it quits.

    I can see thesis or wordpress re-catches itself becuase I don't get a blank page, but, there is no trace of my extra sidebar...

    where is the function sidebar_3() defined? Is registering it sufficient? I have the feeling the function sidebar_3 should also be defined no? Am I missing something?

    thesis 1.5.1 wordpress 2.8.3
  • hi ilya,
    If you look above you define the sidebar in custom_functions.php ( I have spaced out some tags so they will show):

    / * CUSTOM SIDEBARS * /

    register_sidebars(1,
    array(
    'name' => 'Sidebar 3',
    'before_widget' => '< li class="widget %2$s" id="%1$s" >',
    'after_widget' => '< / li >',
    'before_title' => '< h3 >',
    'after_title' => '< / h3 >'
    )
    );

    Once you have that defined and have setup your function as I assume you have done you need to make sure that the page you are wanting the custom sidebar on has the "custom template" option selected in the edit page for that specific page. Otherwise Thesis will not know that you want to run a custom template on that page and swap out the sidebars.
    Let me know if you have any questions.
    Hope this helps.
  • ilya
    Hi Berchman,

    Thanks for the quick reply. I really apreciate it.

    It seems I was not really on track: was testing with a custom sidebar that contains a subnavigation element. I was checking it on a page that did not have subpages... Doh.

    I get my example to work with the call
    dynamic_sidebar('Sidebar 3');
    or
    dynamic_sidebar(3);

    but not with:

    sidebar_3();
    This outputs something, but does not "load" the sidebar with the defined widgets..

    I have declared the third sidebar as you have done above.

    Could it be a dependance on a php version?
  • escalatoraccident
    Hey Berchman,

    First off, thanks so much for the tutorial. I appreciate you taking the time to help.

    I'm running into some problems and I posted my question and all my code on the forum. I'd dig it if you could check it out.

    http://diythemes.com/forums/customization/9441-...

    Thanks in advance for any help.
  • robyn
    Thank you!
  • robyn
    Okay, so if I read correctly...

    I have 2 SB on my front page. I want 1 on all other pages. In order to accomplish this, I must create a page template without sidebars and then add on in using custom_functions.php. Correct?
  • Hi Robyn,
    Yes that is the way to go.
  • Hi - thought following email it may be helpful to show you where am with code; and leave a page up for you to see. My standard format is sb, content, sb and in this example I tested calling sb 3&4 to the custom template Chateaux; so close and yet feel so far!

    In custom functions:

    function custom_sidebar_01() {
    if (is_page('chateaux')) { ?>



    <?php the_title('', ''); ?>








    Not Found
    Sorry, but you are looking for something that isn't here.










    <?php } }
    remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
    add_action('thesis_hook_custom_template', 'custom_sidebar_01');


    In custom css:

    div#sidebar_3.sidebar, div#sidebar_4.sidebar {
    width: 195px;
    }

    div#sidebar_3.sidebar {
    float: left;
    }

    div#sidebar_4.sidebar {
    float: right;
    }

    Have a feeling the custom css wrong but can't seem to get it to play - don't know right references for sb order i.e content, sb, sb or sb, sb, content or, as in my case sb, content, sb.

    You can see the funky results here:

    http://www.mamanmedoc.com/chateaux/

    Would be so great to crack this as been at this on and off for 2 months and not nailing it!

    Thanks
  • Hello,

    any suggestions about how to fix this nasty problem: myhalalkitchen.com

    If you scroll down, you'll see all my sidebar widgets (2 columns worth) where they don't belong. Can you offer any suggestions on how to fix this?

    thanks!
  • Yvonne, Looks like you got it sorted out. I was going to suggest looking at the width of your content area in the css.
  • I was wondering how I can reduce the space between my widgets in the sidebar. I don't know much about css but I think it's got something to do with padding? Any help appreciated...
  • Mandy, you will want to edit the css that governs widgets. Widgets are put into an unordered list in the sidebar. Each widget is in a line item and you will want to adjust the margin and padding on that element.
  • kazclark
    Hi - I wonder if any of you kindly sidebar gurus may have an idea re an issue I am having. I managed to get the template working (a huge win for me!) but my widgets are loading up oddly. First my sidebars stacked on one side but then I css's them float left, float right; and they went in my format sb/content/sb. But widgets loading middle down on my sb3 and top up on my sb4! I do wonder if I did my template wrong for the sb/content/sb format; or if the css call not supposed to be used for separating the sbs like I have. Have popped this on a slow burn but am really out of ideas as not knowing what I don't know! Thanks very much.
  • Hi Kaz,
    Do you have a URL where I can look at your example? You can email me if you like.
    Hope this helps.
  • Very nice.

    That three column example page you created is exactly what I need. I need a homepage that has three columns with no "bloglike" functionality. In other words, I want the three columns to act like a static website would if just coded with html and css. I need to continuously update the three columns with javascript code. Is this possible with your example and if so, how would I add the javascript to each column on a continual basis.

    thank you for your time.
    Shane
  • I have successfully registered sidebars and they are showing up in my Appearance. I've got lost in the "call" code above though. If I want to call sidebar 1 (standard) and sidebar 3 (custom) on particular page how do I do that? I don't have custom page templates as just use wordpress pages; so trying to simplify it and have got here ...... I think my referencing re custom template etc wrong as jst wanting to change sidebars i.e. on a particular page to call two particular sidebars. The other bits of code above have not sunk in as to why I personally would need them "Not Found" etc; maybe I am missing huge point but I don't have custom pages, just would like to customise my sidebars! Feel close, but not on the nose! Thanks!

    function custom_sidebar_01() {
    if (is_page('places')) { ?>






    <?php } }
    remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
    add_action('thesis_hook_custom_template', 'custom_sidebar_01');
  • Smashing tutorial - thank you!
  • ok, so using to show an example didn't work :)

    What I was trying to point out is that if you only put the php sidebar into a div with ID sidebars, Thesis will not style it as a normal side bar.

    If it is embedded the same way as a built-in sidebar, the built-in CSS will catch hold of it.

    It would need to be embedded in several layers for this to happen:
    <div id "sidebars"
    <div class "sidebar"
    <ul "sidebar_list"
    <php sidebar_whatever();
    </ ul
    </ div
    </ div
  • Nick
    Thanks, I've been getting good use out of that tutorial. Making a custom template for a post is what's hanging me up.
  • Nick
    Hi Berchman,

    Is there a way to remove a sidebar from a post? I'm using a 2 sidebar setup, and would like to be able to remove one or both from posts in certain categories.

    Thanks!
  • I would follow my other tutorial to create a custom page template. In that tutorial you can see how you could create a page layout that does not include any sidebars.
    Let me know if you have any questions.
    Hope this helps.
  • Hi Berchman,

    I am new to Thesis Theme. I've just used it one week ago. One problem that bothers me is that my sidebar widgets did not display on Internet Explorer browser.

    I don't know yet what has been caused. Please let me know if you can find sometimes to check it.

    Your reply is highly appreciated.
  • I didn't notice your reply until I found your back links at Yahoo.com, well thanks for the tips and had fixed it.
  • Hi Anton,
    When I just visited your website I see the sidebars. However I am using Google Chrome. :-)
    Have you fixed it?
  • I went ahead and did it the easy way -- just copying the widgets. Thanks for replying & for a great site.
  • Thanks for a great post, but I have a rather simple sidebar question: I now have one sidebar, but need two. I want Sidebar #1 (my existing) to appear on the right side - and Sidebar #2 (the new one) to appear on the left. The built-in Thesis options don't let me do this. Can you tell me how I can?
    Thanks in advance for whatever help you can provide....
  • Hi Alan,
    There are 2 ways to go about this. Simplest would be to copy down whatever widgets/customization you have in sidebar #1 and mirror that in sidebar #2. Then create a new sidebar #1 with whatever widgets you would like. Then in Thesis layout you could order your layout:

    [sidebar-1 (new sidebar)] [ content-area ] [sidebar-2 (current sidebar)]

    This should be the simplest way to do what you want. However....

    If you want multiple layout options I would follow the directions in my other tutorial regarding multiple custom page templates. You are going to want to create a layout where you place your current sidebar to appear on the right and the new one on the left. You hand code it so you have have the order come out however you like.

    Let me know if you have any questions.
    Hope this helps.
  • This is what I've been looking for. It's much easier and a more elegant solution to use included widgets and additional sidebars than hand jamming each and every custom page. Thank you señor!
  • Wow and thanks for the tips and tricks. I like the way you explained all the details in full. I think I will be using this in my next project which will be starting later this year, you have given me an idea.

    With WP 2.8, when released, will allow you to use many instances of widgets. That is what I understood.
  • @Damon - Thanks so much! You're the man. I knew there was some simple solution. You see, these are the types of options in Thesis that really make me love it. I can do some of the php hooks and stuff, but these little options save me sooooo much time. Now, I need to figure out how to hide the nav bar on this page too and I'll be set to have a landing page within my blogsite as well.
  • @Rick

    On the right side of the create/edit page page, there is a box that lets you select a template. By default there is a no-sidebars option.
  • Hey man, thanks for the great info. Honestly though, all I'm looking to do is to hide the sidebars completely on a page, in order to create a type of landing page. Is there not some simple way to do this?
  • Hi Jenn,
    You would follow the above code for the custom page template but do not call the sidebars at all. Depending on how you want the page width handed, etc. you would control that in you custom.css file. Hope this helps.
  • What is the code to insert to get rid of the default sidebars entirely? In other words, there is a template for a page without sidebars, but if I want to create a custom page without sidebars, how do I tell Thesis not to insert the sidebars that has been set up as a default using the Options page? Thanks in advance.
  • Nicky
    Sorry for back to back comments. It seems wordpress isn't displaying the statement. I'm using

    (without hyphens)
  • Nicky
    Oops, missed the statement in above comment ->>
  • Nicky
    Hmm, I left in your code above as it is. Isn't it for calling sidebar 3?
  • Nicky
    Thanks for the tutorial. Somehow, I'm not able to get it work.

    I created the third sidebar, I can see it in admin menu of Wordpress.

    I changed two things in the code you provided above -

    1) I used is_page('About') since I want to try it out on About page.

    2) I removed the call since I've only created third sidebar.

    The default scheme is s1-content-s2 and I want to have content-s3 on About page.

    Any idea what went wrong ? Any help would be great :)
  • Hi Nicky,
    If I understand your comment #2 correctly you are not calling the sidebar?
    How are you calling sidebar 3?
  • Another great article.
    This one will come in handy for a project I'm working on - thanks Bert!
blog comments powered by Disqus

Previous post:

Next post: