Thesis Tutorial: Sidebars However You Like Them

Featured Image

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. (more…)

Comments
Is there any way to fix widget without using Q2W3 Fixed Widget because this plugin reduce score in gtmetrix, pindom tools and in google insight.
[…] of Individual Tabs on the Thesis Navigation BarHow To Add Banner Ad To Your Thesis Theme HeaderThesis Theme Sidebar Tutorial8 Thesis Theme Design Tips To Make Your Blog BetterTweaking Your Blog Design with CSSAmazing Thesis […]
[…] of Individual Tabs on the Thesis Navigation Bar How To Add Banner Ad To Your Thesis Theme Header Thesis Theme Sidebar Tutorial 8 Thesis Theme Design Tips To Make Your Blog Better Tweaking Your Blog Design with CSS Amazing […]
Robert
how does one remove a sidebar title, i would like to see it inside the widget page for reference but not on a webpage, thank you.
Hi Berchman,
Thanks for this great tutorial.
One question though – if we use a custom sidebar template on Sidebar-3 page (as used in this tutorial), will this custom template be used on all the children pages as well (e.g. /sidebar-3/custom-page-1/)?
Cheers
Hi Bhanu,
No, the children pages should not inherit the custom template unless you select the template from the drop-down. Although if you wanted to get crafty, you might be able to write some PHP to do it automatically for you. Hope this helps.
Thanks,
Bert
Jonlenhart48
hey, great article. I am having trouble. I am trying to make the thesis theme do s1-content,-sw2 and its not working. s1 just goes under the content and teh content does not move to the right. Can you help me!!! email me back at if you can help!
Hiya!
Thank you for this. I am having a slight problem, tho, as WP bounces back ” Call to undefined function sidebar_3()” when I call sidebar3(); inside my function.
I have registered the sidebar with the code you offer up top and have dragged widgets into it via visual editor, but I get this error. Which makes sense, because I don’t define the sidebar_3() function anywhere in the code. So how are you seeing the sidebar at all, when in your example you never actually define function sidebar_3() either?
Am I missing something?
Thanks in advance!
Kat
How to rename the dynamic_sidebar() with generated_dynamic_sidebar()  Do you know how to rename this using hook or filter or something. Thanks for help.
Clegeard
Hi, thanks for this article, it helps me a lot.
The only, I can’t get it work with category pages.
My code is this way :
register_sidebars(1,
    array(
        ‘name’ => ‘Sidebar Offers’,
        ‘before_widget’ => ”,
        ‘after_widget’ => ”,
        ‘before_title’ => ”,
        ‘after_title’ => ”
    )
);
function custom_sidebar_offers() {
    if ( is_category( ‘ofertas’ )  ) { ?>
   
   
       
           
                       
           
       
       
<?php } }
remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'custom_sidebar_offers');
When I apply it to pages, it works (as I can choose to apply custom template to pages from the admin panel), but with categories no way.
I hope you can help.
Thanks
Christèle
@Clegeard
your conditional statement is using “is_category”
Try using “in_category” to see if that helps.
Terima kasih atas tutorialnya gan.keren banget 😀
Excellent posts. I have a question:
how to indicate you want to target all of your blog posts with a particular sidebar and not your pages?If you can target by category do you still write…if (is_page(category-name))…Or, how do would you build a function to test for all, any, categories to render one custom sidebar for all blog posts?
Thanks again for helpful tutorials.
_Cindy
why do I have a black bar at the top of my sidebar?
http://thebodyandsoullifeline.com
Most likely the setting for Multimedia box is set to display.
Hi Chris,
Could be your Multimedia box, pretty sure it is.
You can turn that off in Thesis design preferences.
Hope this helps.
-Bert
thanks for the tutorial
Found this article thru google and it will most definitely help me out with the redesign I’m doing over on my blog with my sidebars. Thanks a bunch. 
~Al
I’m still struggling with this.  I was thinking thesis was easier to change than it is.  I don’t like the “hooks” yet.
Brian
Great tutorial!
I’m having trouble reducing the space between widget items.  Any thoughts?
Thanks,
Brian
Most likely there is some element that is within the widget that is set to display as ‘block.’ For example and h2, h3, hx etc. would need to set CSS to display “inline-block” Hope this helps.
Guest
I would love to be able to give a different colour to each sidebar , content and footer. 
You would need to set specific class values to different elements (divs, ids, etc.) then style it using CSS. Hope this helps.
Ronallie
finally I understand my problem plenty of thanks for this 🙂
Nanette Turner
Is there a way to remove the sidebars for a custom home page layout?  (I used your tutorial to create multiple custom pages, but would like to remove sidebars on certain custom pages.)
Sure. You could just comment out the code, or simply not include it. Or you could select the “no sidebar” option when you specify the type of page template.
fatos
Hi there….
very well written article, can someone tell me how to go about doing this,
I want both sidebars shown on home page but only sidebar 2 on a single post
                        home page
sidebar 1 – content area – sidebar 2 
                       single post
    content area – sidebar 2
Thank you
very good tutorial, everything is explained step by step
Ccmkramer
I put this in my custom_functions.php.: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;
}
and got this error:
Parse error: syntax error, unexpected T_STRING in /home/ccmkrame/public_html/wp-content/themes/thesis_18/custom/custom_functions.php
on line 32
My website is completely gone (only the above error shows), and I can’t get into my admin panel to take out what I put in either (again, only the above parse error shows).  Can someone help?
Hi ccmkramer,
If you login via FTP you can open your custom_functions file and take out the offending php.
The error is in your custom_functions.php file. Once you remove the offending code your site will come back online.
Hope this helps.
I’m totally new to Thesis and have spent the weekend playing with it and getting frustrated! This tutorial looks like it’ll be of great help once I actually get my head around php… yup, I’m a newbie at that too.
My question is: how do I get my sidebar(s) to simply move above my multimedia box? It seems odd that thesis doesn’t allow you to do this intuitively. I don’t (necessarily) want to create a new sidebar to put custom code in to act as a MM box as this is a bit beyond me right now.
Perhaps I’m missing something really obvious but I just can’t seem to find a simple explanation of how to do this anywhere!
Thanks
Leigh
Aaron
I’m just not getting it. I need to add 2 additional side bars to all pages. I get as far as them being added to the widget page, but they do not render on the site. Do I need to create a custom layout to make this work? How do I test for “all pages” if that is the case? I know barely any php so any help would be much appreciated.
Thanks for the info, Its very helpful for me..!!
Great article about sidebar customization. Defiantly it help me but also helps who want to use thesis in future. Currently I want to get thesis.
Thanks for the article
Emma
Hi and thank you for this tutorial!
I am able to get the code to work so that two custom sidebars are shown on a specified page, for example:
function custom_template_sidebar_2() {
if (is_page(64)) { ?>
and so on…
This works fine.
But could you please, please tell me how to state the condition in order to show the custom sidebars if I have WP set to show blog posts instead of a static front page.
I have tried
if (is_home()) { ?>
which doesn’t work but I understand that the condition needs to test for all pages that are not the “home” page.
How would such code look?
I have tried
if (!is_home()) { ?>
without any success.
I am not a deadly programmer and really really need to figure this out.
Cheers from Ireland.
[…] Go here to see the original: Thesis Tutorial: Sidebars However You Like Them — berchman.com […]
I would like to completely remove the sidebar.. I thinking a hook but not sure how to do it quite yet.. any help is appreciated
If you want to remove the sidebar from a certain page or a post.. you can directly do it with WordPress. Right above the publish button, there is an option to select template. In that template, select no sidebars. Your post or page will be published without any sidebars.
Ha… I am still really struggling with these sidebars. I wish Thesis would integrate single sidebar templates along with the standard ones… Maybe it will be coming in 2.0!
I believe I made a comment but I am not sure it came through. I’ll try once again.
I have a three column template and is satisfied with it and want to use the same template for my pages as well as for the blog post page. But what I do want for the pages is different content in the sidebars for each page.
What I’ve done (using http://brian.se.linweb58.kontrollpanelen.se/om_brian/ as the page in focus – temporary url).
1. Picked the Custom Template for the /om_brian/ page and published it.
2. Inserted the following code (I chose to keep one of the default sidebars in this case) into custom_functions.php:
/* Custom sidebars */
register_sidebars(1,
array(
‘name’ => ‘Sidebar 3’,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ”,
‘after_title’ => ”
)
);
register_sidebars(1,
array(
‘name’ => ‘Sidebar 4’,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ”,
‘after_title’ => ”
)
);
/* Sidebars Om Brian */
function custom_sidebar_01() {
if (is_page(‘om_brian’) || is_page(‘2′)) { ?>
<?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');
3. Used the same .css data as in your case (although I changed the width to 195), just to try it out.
4. The result is a mess with only one sidebar spanning over two columns. Nothing from my newly created sidebar shows up.
I obviously screwed something up. Keeping sidebar 2 to the right and introducing sidebar 3 to the left.
When using:
I get this error message (the above is located on line 59):
Fatal error: Call to undefined function sidebar_3() in /home/web81573/domains/brian.se/public_html/wp-content/themes/thesis_16/custom/custom_functions.php on line 59
When using instead it looks like this:
http://brian.se.linweb58.kontrollpanelen.se/om_brian/
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.
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:
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.
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!
[…] Unlimited Sidebar Options?! Bert Mahoney (@berchman) says “With this tutorial your sidebar options are limitless and the boundaries are defined by your needs.” Go on, get sidebars however you like them! […]
Great post, I have recently bought the thesis after hearing so many good reviews about it but after installing it, I found that it is very difficult to customise it. Thanks for this tutorial, it will going to be very helpful 🙂
LGV
thanks a lot for this helpfull article !
But i have a problem when i tried it. Maybe because i don't talk enough in english i don't know.
i have this error message : Fatal error: Call to undefined function sidebar_4() in custom_functions.php on line 185…
can you help me ?
Christian and Ken,
I have a tutorial coming up soon that will show you how to achieve 4 different page layouts using a 3 column standard Thesis display and about a dozen lines of CSS code. Hope to post soon. I think it will either provide you with an answer or give you inspiration. Hope this helps.
Ken
 Berchman – did you ever do the tutorial you mentioned above?
Jess
Thanks for the tut! I’m trying to accomplish the same thing at Christian and Ken, hiding my second sidebar on specific pages. I looked for the 4 layout/CSS tut you mentioned but didn’t see it, please let me know if I’ve missed it.  
Hi ak,
You are partly on the right track.
You need to use the is_page() function and test for your specific blog page.
For example:
is_page('blog')
if the “slug” of your page is “blog”
Also, be sure to have your “blog” page set to use a custom template from the dropdown menu in the page admin.
Hope this helps.
Brandon, You need to create another sidebar, use a 'hook' to insert the sidebar before the MM-box, then use some crafty CSS to get it sized and displaying properly. Hope this helps.
Brandon, You need to create another sidebar, use a 'hook' to insert the sidebar before the MM-box, then use some crafty CSS to get it sized and displaying properly. Hope this helps.
Ken
This is what I'm looking to do as well, Christian. It seems as though we need to create a full custom template, but just omit sidebar 2 and tailor the css as needed, but i'm stumped on how to do this.
Ken
This is what I'm looking to do as well, Christian. It seems as though we need to create a full custom template, but just omit sidebar 2 and tailor the css as needed, but i'm stumped on how to do this.
Christian
Very helpful and was looking for this quite a while. But what if I want to keep the standard sidebar 1 on my custom page, but delete S2 and use the remaining full width?
[…] are looking for more in-depth custom styling for your layout, check out this awesome tutorial on Berchman. However, if you are looking for an easy way to simply add custom sidebars, read […]
ak
Hi Berchman,
This goes without saying that your article are very informative. I followed them and they work flawlessly. BUT… yeah as ususal there is always a BUT..
I have created a static home page and then created a “BLOG” page > chose it as my blog page under wp > admin… now no matter any custom template page I create, it doesn't apply to this blog page.
Apart from this there doesn't seem to be any function or hook to remove a sidebar in thesis… or maybe I am not away of this..
Even “is_page()” doesnt work as it seems that this blog page is not considered as a page by wordpress, though it has an id. Only condition which works is — “if(!is_page()){ }
All I am trying to do is create a separate sidebar(eg:sidebar 2) for my blog and let the sidebar 1 for rest of the site pages..
Any suggestions?
Thanks for your anticipated response 🙂
ak
Brandon
Hi thanks for this,
I recently just got thesis and I'm using a 3 column layout. But I would like to add another sidebar that appears in every page just before the multimedia box. (and i want this new sidebar to take the combined width of the default 2 sidebars)
Exactly how do I do that?
thanks In advance!
There are a few widget plugins I know of that will allow you to specify what to show based on page, post, category, etc. They are very handy. AND when combined with something like this script makes the possibilities infinite.
Thank you so much, I will check this out. Meanwhile I found the plugin Widget Logic which is making this type of solution possible in a similar but maybe to simple way.
You most likely have conflicting code. For example you need to check all the #'s that are being used:
sidebar_3();
custom_widget_02;
etc.
My bet is that the conflict is in the definition and calling of the sidebars. Hope this helps.
You need to define a background image for div#sidebars
Depending on the gradient you will want it to repeat vertically or horizontally so CSS accordingly.
Hope this helps.
Its in the sidebar(s) you are calling:
<div id=”show-only-3-and-1″>
<?php dynamic_sidebar(sidebar_3); ?>
<?php thesis_sidebar_1(); ?>
</div>
You have registered the sidebars but have not built the right functions to call those newly registered sidebars. You need to add:
/* ADDITIONAL SIDEBAR FUNCTIONS */
/* sidebar 3 function */
function sidebar_3() { ?>
<div id=”sidebar_3″ class=”sidebar”>
<ul class=”sidebar_list”>
<?php thesis_default_widget(3); ?>
</ul>
</div>
<?php }
/* sidebar 4 function */
function sidebar_4() { ?>
<div id=”sidebar_4″ class=”sidebar”>
<ul class=”sidebar_list”>
<?php thesis_default_widget(4); ?>
</ul>
</div>
<?php }
Then in the code you have above where you have this:
<div id=”show-only-3-and-1″>
<?php dynamic_sidebar(sidebar_3); ?>
<?php thesis_sidebar_1(); ?>
</div>
Use this instead:
<div id=”show-only-3-and-4″>
<?php sidebar_3(); ?>
<?php sidebar_4(); ?>
</div>
That should do it.
[…] Sidebars However You Like Them An ind-depth look at Thesis sidebars and how to adjust them to suit your needs. […]
sonnyboytan
hey, berchman. i seem to have problems combining your unlimited sidebars with kristarella's widgetized footer. when i register the sidebars, they register on the footer instead of beside the content area.
i'm trying to make my homepage have 3 columns instead of 2 columns. so i opted for your custom page template design. now i have a problem customizing my custom page template. what do you think is the best option for me now? am i overcomplicating things?
[…] are looking for more in-depth custom styling for your layout, check out this awesome tutorial on Berchman. However, if you are looking for an easy way to simply add custom sidebars, read […]
I think you people are first who have written an article on Side bar customization. It' s great buddy.
Carry on with ur sweet blog.
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.
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.
Sure you could create a conditional that tests for “any page that is NOT the home page” then supply the needed custom template.
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.
You can use the 'no sidebars' option in the custom menu dropdown.
Edwin, Drop me a note using my form and I will be in touch: http://bit.ly/bujJJK
I am now exploring the use of video on the tutorials. I know different people learn different ways so this is on my radar.
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.
I didn't notice your reply until I found your back links at Yahoo.com, well thanks for the tips and had fixed it.
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
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?
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.
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.
Gus
I just starting with thesis but i like it more every sec! 🙂
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.
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
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!!
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.
Hi,
I really would like to give acces to my blog (http://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 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:
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)?
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.
thanks … i am a newbie to thesis theme … this is helpful 🙂
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?
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!
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
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.
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.
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.
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?
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'=>'<h3>',
'after_title'=>'</h3>'
)
);
/* 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('<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>
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
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.
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,
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,
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' => '<h3>',
'after_title' => '</h3>'
)
);
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)?
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…
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.
michaelmindes
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…
Great to hear that you succeeded.
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 🙂
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?
Thank you!!!
I have been beating myself up for hours now trying to figure out why this tutorial wasn’t working. I’m not that great at PHP, but when the error was telling me that sidebar_3() hadn’t been defined I knew something was missing from this tutorial. Your little tip got it to work! Thank you again.
@berchman: This tutorial is awesome, but it did take a little figuring out because of what I ilya and I went through. Thank for this anyway though, it’s making Thesis even better for me.
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,
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 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.
Hi,
I really would like to give acces to my blog (http://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 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:
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)?
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.
sagar2121
can u please tell me how do i change the advertise here boxes in the sidebar
I made the changes but when i try do change it again it shows the previous boxes only here is my code
CUSTOM VARIABLES
//
// defaults
if (get_option(’tt_ad_one_img’)) {} else { add_option(’tt_ad_one_img’, ‘ad1.gif’); }
if (get_option(’tt_ad_two_img’)) {} else { add_option(’tt_ad_two_img’, ‘ad2.gif’); }
if (get_option(’tt_ad_three_img’)) {} else { add_option(’tt_ad_three_img’, ‘ad3.gif’); }
if (get_option(’tt_ad_four_img’)) {} else { add_option(’tt_ad_four_img’, ‘ad4.gif’); }
if (get_option(’tt_footer_opt’)) {} else { add_option(’tt_footer_opt’, ‘false’); }
remove_action(’tt_ad_one_url’, ‘http://YOURID.maverick66.hop.clickbank.net/’);
if (get_option(’tt_ad_one_url’)) {} else { add_option(’tt_ad_two_url’, ‘link for second image’); }
if (get_option(’tt_ad_two_url’)) {} else { add_option(’tt_ad_two_url’, ‘link for second image’); }
if (get_option(’tt_ad_three_url’)) {} else { add_option(’tt_ad_three_url’, ‘link for the third image’); }
if (get_option(’tt_ad_four_url’)) {} else { add_option(’tt_ad_four_url’, ‘link for the fourt image’); }
$tt_footer_removal = get_option(’tt_footer_opt’);
$tt_twitter_username = get_option(’tt_twitter_name’);
$tt_a1_img = get_option(’tt_ad_one_img’);
$tt_a1_url = get_option(’tt_ad_one_url’);
$tt_a2_img = get_option(’tt_ad_two_img’);
$tt_a2_url = get_option(’tt_ad_two_url’);
$tt_a3_img = get_option(’tt_ad_three_img’);
$tt_a3_url = get_option(’tt_ad_three_url’);
$tt_a4_img = get_option(’tt_ad_four_img’);
$tt_a4_url = get_option(’tt_ad_four_url’);
//
// END OF CUSTOM VARIABLES
//
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!
andimac
I'm getting the same php error. I think I'm missing something major here but can't figure it out.
When you say you write a function to call the sidebars… what does that mean? Doesn't including that bit of code
<div id=”sidebars”>
<div id=”show-only-3-and-4″>
<?php sidebar_3(); ?>
<?php sidebar_4(); ?>
</div>
</div>
in your custom template page do the trick? Do I have to define another custom function too? Sorry… confused. – Andi
thanks … i am a newbie to thesis theme … this is helpful 🙂
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 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.
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.
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.
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?
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'=>'<h3>',
'after_title'=>'</h3>'
)
);
/* 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('<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>
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
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.
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,
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,
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' => '<h3>',
'after_title' => '</h3>'
)
);
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)?
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…
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.
michaelmindes
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…
Great to hear that you succeeded.
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 🙂
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?
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,
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 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.
[…] 10. Sidebars However You Like Them – Berchman […]
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.
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.
thanks … i am a newbie to thesis theme … this is helpful 🙂
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?
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.
[…] Thesis Tutorial: Sidebars However You Like Them — berchman.com http://www.berchman.com/thesis-tutorial-sidebars-however-you-like-them – view page – cached #berchman.com » Thesis Tutorial: Sidebars However You Like Them Comments Feed berchman.com RSS Feed — From the page […]
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?
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'=>'<h3>',
'after_title'=>'</h3>'
)
);
/* 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('<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>
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
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.
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,
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,
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' => '<h3>',
'after_title' => '</h3>'
)
);
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)?
berchman
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.
berchman
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.
berchman
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.
berchman
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…
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.
michaelmindes
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…
berchman
Great to hear that you succeeded.
[…] Unlimited Sidebar Options?! Bert Mahoney (@berchman) says “With this tutorial your sidebar options are immeasurable and the boundaries are circumscribed by your needs.” Go on, intend sidebars ease you same them! […]
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 🙂
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?
berchman
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.
berchman
Hi ilya,
the php code you tried to post did not show.
If you put spaces between the ? and php it should post fine. Try that
then I can take a look.
berchman
Hi ilya,
the php code you tried to post did not show.
If you put spaces between the ? and php it should post fine. Try that
then I can take a look.
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
[…] more here: Thesis Tutorial: Sidebars However You Like Them — berchman.com Comments0 Leave a Reply Click here to cancel […]
[…] Read more from the original source: Thesis Tutorial: Sidebars However You Like Them — berchman.com […]
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.
Thanks in advance for any help.
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:
Would be so great to crack this as been at this on and off for 2 months and not nailing it!
Thanks
[…] Thesis Tutorial: Sidebars However You Like Them […]
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.
Hi Anton,
When I just visited your website I see the sidebars. However I am using Google Chrome. 🙂
Have you fixed it?
Alan M
I went ahead and did it the easy way — just copying the widgets. Thanks for replying & for a great site.
Alan M
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!

Comments are closed.

LAST BIT

bertmahoney.com was made for you by me—Bert—using WordPress with the Semplice theme, a variety of plugins, a sprinkling of custom programming for effect, lots and lots of coffee—actually too much coffee—and 90's hip-hop.

Word.

 

 

More details in the Colophon.

© BERT : MCMXCV — MMXXIIII

Back to top Arrow