123 Responses

  1. Themelit
    Themelit Published |

    Luckily all our themes we’re building are build off some awesome framework called Hybrid Core.

    ;)

    Reply
  2. Javier Márquez
    Javier Márquez Published |

    Oh yes, theme developers, please, read this post!! I completely agree with it, some themes lacks on define the sidebars properly and it is no so hard to do things in the correct way. This is a great tutorial, and a must read for a theme developer.

    I made a plugin (custom sidebars) for creating all the sidebars you need easily from the admin area, a functionality that i think WP should have out the box, and its main issues are related with themes that doesn’t use correctly the dinamic sidebars.

    Wordpress has a great potential with its widgets and sidebars, we can push it much further.

    Reply
  3. Barrett Golding
    Barrett Golding Published |

    excellent tut, as usual. but shouldn’t ‘after_widget’ close the tag, like this:
    'after_widget' => ''

    Reply
    1. Barrett Golding
      Barrett Golding Published |

      make that:
      'after_widget' => ''</div>"

      (you have a tag opener: <div>)

      Reply
  4. Ed Nailor
    Ed Nailor Published |

    Justin,
    Thanks for the information. Its always interesting to get the opinions from some of the main developers as to what could be done better.
    I consider myself more of an intermediary developer. I have a pretty good handle on how WordPress works, a fairly good understanding of PHP as a language and the ability to research things I am unsure of. Recently I began working on my own framework for the many projects I develop, and in doing so decided I wanted a framework I could be proud to share with others. I wanted to make sure the coding was clean and used the most up to date techniques and functions WordPress offered. A lot of what I have used in the framework I found in the TwentyTen theme.
    I personally would LOVE to hear more about the issues you are seeing in WordPress themes. While I do not feel my framework is quite ready for release to the public yet, I am striving to make sure it is of top quality and this type of feedback is great!
    Thanks again.
    Ed

    Reply
  5. Ed Nailor
    Ed Nailor Published |

    Justin,

    I was just doing some research on something I want to do with widgets, and look what I ran across:

    http://codex.wordpress.org/Widgets_API#Display_Sidebar_on_Theme

    Here, the WordPress Codex gives the exact “if(function_exists)” setup that you mention as outdated. This may be a big reason you are seeing this so much still… the basic WP documentation still references it.

    Maybe this should be addressed?
    Ed

    Reply
  6. Ed Nailor
    Ed Nailor Published |

    On that note, what I am looking to do with widgets is something similar to what you were trying to do a year or two ago (damn, you are so far ahead of me!)

    For styling purposes, I want to allow each widget to have its own unique class when the user adds the widget. Since I won’t know what the widgets will be, I can’t call the specific widgets in the css. It seems you were looking for a way to add even and odd classes to the widgets. Did you get anywhere on that? Or, even better, do you know of anything (code or plugin) that will allow a user to add a specific class (possibly by dropdown, field, etc) to each widget as they are adding the widget?

    I use the Widget Logic plugin quite a bit, so ideally something similar that would allow the addition of a class (such as “red”, “dark”, “highlight” or similar terms added to the css) that would specify how that one widget should look would be perfect. Any help or push in the right direction would be helpful.

    Thanks
    Ed

    Reply
    1. Jamal Mohamed
      Jamal Mohamed Published |

      Ed, you can style each widget differently without using a plugin, yes, as long as you correctly follow the steps detailed in this post by Justin.

      Look at this code:

      'before_widget' => '<div id="%1$s" class="widget %2$s">',
      'after_widget' => '</div>',

      The above code creates a div container that wraps the content of the widget. This code also assigns a unique id to every widget, so if I add a text-widget in the primary sidebar, WordPress will assign it a unique id to the container div that wraps the widget. If you view the source of the new created text-widget you’ll see an HTML code like this:

      <div id="text-3" class="widget widget_text">
      <p>I am a text widget.</p>
      </div>

      Now you can open your style.css and style the widget with the id text-3.

      Reply
      1. Ed Nailor
        Ed Nailor Published |

        @jamal: I am aware of this option, but that does not allow the user to apply a class on the fly.

        Let’s say that in my CSS I have 2 classes for sidebars. One would have a dark frame, the other a light frame. If I am developing a theme that anyone could use, I won’t know going in that they will be using a specific text widget and want that widget to have a dark frame. So I would not know ahead of time which ID would be applied to which widget.

        I could use multiple sidebars, and with each sidebar add a unique style. However, what I am envisioning is allowing the user to decide as they add the widget how it would be displayed.

        I know that in using the Widget Logic plugin, this plugin adds a box that allows variables to only show on certain pages using functions such as is_front_page() or is_page(8). However, I would love for the user to also be able to add a specific class in the same manner.

        So since I do not know what the widget ID will be ahead of time, I need something flexible that allows the assignment of a predetermined style class to be applied as the widget is added.

        Anyone with this solution, I would love to see it!

        Thanks
        Ed

    2. Ed Nailor
      Ed Nailor Published |

      Hey Justin,
      I know you are a busy guy, but I was wondering if you have any comment on adding specific classes per widget. I would love to find a way to make this happen… any thoughts?
      Ed

      Reply
  7. Scott Lee
    Scott Lee Published |

    Justin, as always you have provided clear direction.

    Thank you so much for the excellent “tutorial”.

    Reply
  8. Ryan
    Ryan Published |

    There are cases where get_sidebar() might not be appropriate for a specialized theme, but it’s something I’ve rarely seen.

    One of the shortcomings I’ve found with the args to these include functions is the lack of support for subfolders. Things get pretty messy with a big site when your forced to namespace your filenames rather than organize your includes into folders.

    Any thoughts on this?

    Reply
  9. Let’s update those sidebars | WereWP
    Let’s update those sidebars | WereWP at |
  10. Stefano
    Stefano Published |

    @Justin, great article as usual!

    @Ed: I’ve done some research on “custom syle” for widget too… and while we can easly hook in the widget admin screen to ad checkbox or dropdown for adding options, it looks like the “show widget” logic doesn’t contains any hooking capability to add custom tag or anything else.

    The logic that display the vidget simply outputs the “before & after widget”, “before & after title” with an echo statement, so you can’t hook neither there.

    Maybe I’m missing something… Justin? ;-)

    Stefano

    Reply
  11. Randy
    Randy Published |

    This is a great article. I really like when people mention ways to customize and work with the “native” features of Wordpress. Many developers seem to think they need a 3rd party plugin for unique content areas which could easily have used a custom sidebar. I see that even in expensive themes.

    One last note on why to use “get_sidebar” instead of include is because WP will gracefully default if that sidebar template is missing for some reason which is better than seeing php errors on the page.

    It is funny how slightly misleading some of the WP naming conventions can be. I wonder if it were called “dynamic_module” it would be more realized these can be anywhere and even in multiple locations. Same goes for Custom “Post” Types. It really isn’t a “Post”.

    Reply
  12. Michael
    Michael Published |

    Thanks for another great eye-opener Justin.

    And, as previously mentioned by Barrett, would not the div-tag be “closed”? Or have i overlooked something?

    [code] 'after_widget' => ''"[/code]

    Reply
  13. This week’s article roundup. Tune in!
    This week’s article roundup. Tune in! at |
  14. Jeff
    Jeff Published |

    Hey Justin. Thanks for your post. I always find your posts to be thorough and straightforward. They have helped me to make my custom WordPress framework theme much better.

    In this case you busted me on 2 of the bad examples (unnecessary backwards compatibility check and not using IDs). So it’s back to work I go. Thanks again.

    Reply
  15. Ed
    Ed Published |

    @Stefano if I could access the widget interface to add a drop down that could be attached to and called with each unique widget, I could use it to add a div around the widget, correct? That would give the ability to target widgets within that class, right?

    I am not sure how to access the widget interface so if you can point in the right direction it would greatly appreciated!

    Reply
  16. Paul
    Paul Published |

    No, this is not the Yet-Another-Blog-Post-About-WP-Sidebar

    This is the best one !

    Thank you very much for all the comprehensive WP articles here.

    Reply
  17. Sami
    Sami Published |

    I was just making my sidebars for the first time, so this was right on spot. Thank you!

    Reply
  18. Jeff
    Jeff Published |

    I especially found the “Collapse sidebars without widgets” part helpful for allowing empty sidebars to validate when using unordered lists as the widget containers.

    Reply
  19. Jamal Mohamed
    Jamal Mohamed Published |

    I was recently thinking why people check if the function register_sidebar() exists, which was present in the WP core since 2.3 as I guess. This is something I guessed you’ll talk about when you mentioned “bad sidebar code” earlier in this post.

    Also I’m against this aimless backward compatibility check which really harms the way we develop themes and plugins. In this case, we’re only helping hackers by making end-users stick with their old WP installations.

    As for using <li></li> tags in before_widget and after_widget, I’d choose the <li></li> over the <div></div>, as the former one seems more semantic and can support Microformats easily.

    Reply
  20. Steve Mortiboy
    Steve Mortiboy Published |

    Another great post. Thank you Justin.

    I’ll be very interested to read your other future related posts like how to “create dynamic widths for your content depending on which sidebars are active/inactive” and what other common mistakes you’ve found with themes.

    Reply
  21. links for 2010-11-14 | zota
    links for 2010-11-14 | zota at |
  22. Weekly WordPress Review - WPCanada
    Weekly WordPress Review - WPCanada at |
  23. Prevent Senior
    Prevent Senior Published |

    Excelentes dicas nesse blog adorei….

    Reply
  24. Elia Durban
    Elia Durban Published |

    I’m not a designer of theme but I’m interested in what you said to be: downright nasty code. What does that mean and how do I know.
    Thank Justin

    Reply
  25. dee8
    dee8 Published |

    great post Justin, informative and straight to the point.

    Reply
  26. How to load files within WordPress themes
  27. Pierre Saïkali
    Pierre Saïkali Published |

    Useful post about sidebars, thanks for sharing!

    Reply
  28. Ronny
    Ronny Published |

    Is there a way to have sidebars per posts? A major dealbreaker for me, is the lack of adding widgets on a per post basis (for example info boxes, relevant entries etc). WordPress is a very fluid and dynamic publishing tool, but lacks basic features like this.

    How would you solve this?

    Reply
    1. Mike
      Mike Published |

      Great article – thanks, Justin. @Ronny, I just published this super simple graceful sidebar plugin which enables you to create custom sidebars for your posts or pages. Simply install the plugin, create two custom fields in your post called “graceful_title” and graceful_content” with the title and content you wish to have displayed in the sidebar. Next, drag the Graceful Sidebar Widget to your theme’s sidebar and you’re good to go.

      Enjoy!

      Reply
  29. Correct Coding for WP Sidebars | BloggingPro
  30. peter
    peter Published |

    I have created some widgets.By using the default theme of wordpress, I am able to show those widgets either in sidebar or footer. What I need is to show them in the centre..that means where we normally place the contents, but I don’t know how to do…I think I should customize this template.I don’t want to use some other themes, rather I would like to use the default twenty ten theme. Can anyone help????

    Reply
  31. Julien
    Julien Published |

    Great article thank you! Will all the tools available to make themes a lot of creators are falling short when it comes to sidebar content and management.

    Reply
  32. SlowX
    SlowX Published |

    What if a widget has no title and I want to skip the ‘before_title’ and ‘after_title’?

    Reply
  33. Prospress templating how-to | Canadian Pickers
  34. marquex
    marquex Published |

    @SlowX The way that widgets are displayed depends on each widget particulary, so if they have no title some of them will display the before/after title code, but others don’t.

    Notice that before/after title are properties that belong to a sidebar, not a widget, you will have to define for the sidebar, so you don’t know when its widgets will have title or not.

    Having a look at the code i realize that there is an action hook which is called before the widget is printed

    do_action( 'the_widget', $widget, $instance, $args );

    maybe using it you will be able to disable all the befor/after title stuff.

    @Justin, I have linked this tutorial from inside my sidebars plugin, because it rocks!!

    http://wordpress.org/extend/plugins/custom-sidebars/

    Cheers!

    Reply
  35. Djolhan
    Djolhan Published |

    Here is an excellent page for the sidebar. Have found exactly what I search for correctly Widgeting a template ;)

    Thank you for this excellent work.

    Reply
  36. Jesse Taylor
    Jesse Taylor Published |

    Amazing article. Thanks so much for taking the time to write this!

    Reply
  37. Margarida
    Margarida Published |

    hi,
    I am using a theme from WPSHOWER and I just noticed that the sidebars do not have an ID.
    here is the code:

    if (function_exists('register_sidebar')) {
        register_sidebar(array(
            'name'=>'Site description',
            'before_widget' => '',
            'after_widget' => ''
        ));
        register_sidebar(array(
            'name'=>'Sidebar',
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '',
            'after_title' => ''
        ));

    Can I add an ID manually now that the site is already running with a lot of pages and posts or will it just ruin everything?

    And thanks for the tip.
    Maga

    Reply
  38. A
    A Published |

    So, now that the function ‘unregister_sidebar’ is deprecated, how do I unregister it in a child theme short of deleting the register code in the parent theme?

    Reply
  39. Chris J
    Chris J Published |

    Hi Justin,

    I have a theme that I inherited, so I don’t fully understand everything in it.

    In functions.php, there is a call to register_sidebars with a single sidebar definition, and this has the correct format, so looks fine.

    There are two sidebar template files called sidebar.php and leftsidebar.php. These are added to the theme in index.php using 2 calls to locate_template, first with leftsidebar, then with sidebar.

    Both of these files have a call to dynamic_sidebar (as well as a bunch of unrelated stuff). The one in leftsidebar is the one that is defined in register_sidebars in functions.php.

    The strange thing is that both sidebars show up in the admin, and I can add widgets to them both. So the question is, why does the second dynamic_sidebar work, even though there is only one sidebar defined in register_sidebars in functions.php ?

    Reply
  40. Chris
    Chris Published |

    I am incredibly grateful to you for the clarity of this post. As soon as I clear my plate, I am going to read through all of your posts! PLEASE keep writing!

    Reply
  41. Sidebars in WordPress - Justin Tadlock
    Sidebars in WordPress - Justin Tadlock at |
  42. Tempur
    Tempur Published |

    Umm, is there any plugin to install and do all that to me?! I mean I’m not into so it won't be so easy for me...

    Reply
  43. Widget Logic is_active_sidebar fix | Spigot Design
  44. dave
    dave Published |

    Note: The section with the heading “Arguments for dynamic_sidebar()” actually describes arguments for register_sidebar().

    Reply
  45. John Bolyard
    John Bolyard Published |

    Justin – I’m not a developer so I’m encountering a problem I’m having trouble solving.

    I have a dynamic sidebar and I want to style the “Archives”. I don’t know where to look for the actual code for the “Archives” as it displays from the widget to my sidebar.

    Make sense? Any help would be greatly appreciated!

    Great article btw – thanks!

    Reply
  46. Brent
    Brent Published |

    This is fantastic! But when I register the new widgets, in the back-end, the widget handlers are automatically added to the top. In other words, when I go into appearance –>widgets, those show up but at the very top. Is there any way to control what order they do in?

    I appreciate your help.

    Reply
  47. Chelsea
    Chelsea Published |

    Hi Justin,

    Great tutorial – Thank you so much! I am new to Theme Development and I was overwhelmed with the number of different ways to create a diff sidebar for diff pages. Thanks for taking the time to clarify the good/bad code!

    I followed the instructions and my new sidebar appeared on the page, woohoo! I am experiencing a problem though :(

    Now, if I edit a page and hit the ‘update’ button, the screen goes white, while the URL redirects to /wp-admin/post.php. The screen stays white, until I hit the back button & changes are not saved. I log out & when I try to login the screen is white.

    I am developing a child theme for WP Twenty Eleven. So I:
    1. Registered the new custom sidebar in a new functions.php in my child theme folder
    2. Added dynamic_sidebar( ‘sidebar-custom’ ) in new file sidebar-custom.php
    3. get_sidebar( ‘custom’ ) in pages.php

    It seems to me that the functions.php file conflicts with the Parent theme’s function.php file – because when I remove it the site works fine again…but of course no dynamic sidebar…

    I would much appreciate if anyone has any suggestions for me. Thanks heaps in advance.

    Reply
  48. Peter Shackelford
    Peter Shackelford Published |

    Is there a simple way to place our newly created sidebar using a hook? Rather than editing the template file, can we register the sidebar and attach it to a specific place in your theme? All in a functionality plugin.
    Peter

    Reply
  49. Jacob Begun
    Jacob Begun Published |

    Hi Justin,

    I just a new guy in the Wordpress world.
    I try to fix the sidebars with the : { position: fixed; } code line.
    It was good only for one sidebar, but I want to fix also the second one, because I use right and left sidebars. So when I use the code for the second sidebar, the template changes to only one sidebar. I work with the Weaver II Pro.
    Maybe you have some idea about it ?
    Thanks a lot,
    Jacob

    Reply
  50. Felixius
    Felixius Published |

    Thanks Justin!

    The codex can sometimes be as clear as mud.

    Without bloggers like you, I would be completely clueless instead of somewhat clueless… ^_^

    Reply
  51. Moaaz
    Moaaz Published |

    many thanks to you.
    that was very useful. :)

    Reply
  52. Shaggy Dog Story | Flarnie Marchán
    Shaggy Dog Story | Flarnie Marchán at |
  53. Tobias Wagner
    Tobias Wagner Published |

    Great post. Thank you so much. Among all the posts I’ve googled for creating sidebars, this one is probably the best explained and covers pretty much everything.

    Reply
  54. Bob
    Bob Published |

    Good post.

    I was looking at this as I built a child theme on twentyten. I notice in that theme, they call two sidebars in the same sidebar.php file. Of course, they don’t really function as two sidebars from the perspective of a viewer or even a user of the theme — since they are more or less just stacked on top of each other.

    Any idea why it’s set up that way?

    Reply
  55. Bob
    Bob Published |

    So if you weren’t going to use widgets in a sidebar (in a custom dedicated theme for something) you wouldn’t have to register it as a sidebar at all, right?

    You could then just use get_template_part to call it onto a page? Or would that be considered not good practice?

    Thanks again for a great blog. Glad I found this.

    Reply
  56. Jim
    Jim Published |

    Why are these called sidebars? They should be called widget areas.
    I have placed these in the header and footer not just on the sides of the page.

    Reply
  57. milton friesen
    milton friesen Published |

    Justin, maybe this is the wrong place to ask it, but you mention just dropping functions in the functions.php without adding actions. But in child themes, adding actions results in errors. So is just dropping the functions in okay the? or should we use filters or alternative action commads there?

    Reply
  58. sara
    sara Published |

    thank you for this tutorial! I’m a theme developer and a WordPress newbie and this tutorial is a real eye-opener as another commenter said before, thanks again, it helped clarify some of the issues I didn’t understand before, this page has been bookmarked! :) Thanks again :)

    Reply
  59. Casey
    Casey Published |

    You win! Great article, I fixed my problem. Following tutorials that never get updated are there full of errors had me searching everywhere for a sidebar tutorial. Thanks!

    Reply
  60. Andy MacLeod
    Andy MacLeod Published |

    Great tutorial – and I’m reading it nearly two years after it was written.

    Thanks!

    Reply
  61. Brett
    Brett Published |

    Great article – good reading!

    Just a little confused though. You mentioned that for dynamic menus you need to call them via the dynamic_sidebar() function; however then further down you mentioned that..

    “For the best organization of your theme and separation of code, you would create a specific sidebar template for each of your dynamic sidebars. Suppose you created two dynamic sidebars with the IDs of primary and secondary. To best organize these, create both a sidebar-primary.php and sidebar-secondary.php template for handling those sidebars.

    You would use the code below to load both of these sidebar templates:

    So I am confused….. which do I use to display a dynamic sidebar?

    Thanks!

    Reply
  62. nightsmusic
    nightsmusic Published |

    Well, I came here to see if I could find any information on why your My Life template won’t show the secondary sidebar, no matter what I’ve tried. Unfortunately, I don’t see anything that helps. Rather than show the sidebars next to each other, they’re showing the main sidebar at the top of the column and the secondary sidebar below that.

    Really lovely template, but if I can’t get a three column layout, I can’t use it.

    Reply
  63. nightsmusic
    nightsmusic Published |

    That’s okay. I thought your post above might give me some insight, but everything checks in the code. I didn’t do the Theme Hybrid site because it’s $29 a year and I just wondered about this one thing.

    It really is a very nice template, like I said, lovely design. I just can’t use it then. But thanks!

    Reply
  64. Trisha
    Trisha Published |

    Great tutorial, however I’m having a problem with WP ver. 3.4.2….

    Even though I am certain that my code to register the sidebars is correct, and the sidebars are getting registered fine (and allow me to put widgets where I want them), they are not rendering correctly.

    I’m using DIVs, not LIs, as you show above, but the WP code is still rendering my widgets wrapped in the li tag, not the div as I’ve specified…..

    This is very frustrating…..any suggestions?

    Reply
    1. Trisha
      Trisha Published |

      Sorry, I just figured out that I used a hyphen in place of an underscore, making my own problem…..that’s what I get for typing instead of copying & pasting…sigh….

      Thanks again for posting this tutorial.

      Reply
  65. Jim Camomile
    Jim Camomile Published |

    Awesome article as usual. I really enjoy reading your stuff. It is incredibly well laid out and never wastes words. THANKS!

    Reply
  66. Christian Haynes
    Christian Haynes Published |

    This is a great resource if you use Wordpress as a CMS. The steps were detailed and worked flawlessly in my implementation. Thank you for your hard work!

    Reply
  67. Josh
    Josh Published |

    Excellent Tutorial. I’ve been trying to find one like this that takes me through step-by-step for some time now and this was it!

    On a side not, I’m not sure if you have already created a tutorial on this but I would like to know how to enable the ability to choose which sidebar you want to display on individual posts. If you have one that you could send me a link to or are willing to write one, that would be awesome! Thanks!

    Reply
  68. vaibhav
    vaibhav Published |

    How to develop an unlimited sidebar function for wordpress theme?

    Reply
  69. Donald
    Donald Published |

    this is awsome thank you, followed lots of vidio tutorial and were not helping. when I found this tutorial trust me I am the worlds hapiest man. thank you

    Reply
  70. Oliver
    Oliver Published |

    This is very informative. Everything I need to know about sidebars I find here. Thank You!

    Reply
    1. Pattie
      Pattie Published |

      I am FAR from a whiz at WP so here goes and pls pardon my ignorance. I have repeatedly read that the only way to add a second sidebar is to initially edit the functions.php – doing that totally froze my site. I had to go back and edit. So – if I want to add a 2nd sidebar directly under the current (I’m using Soho Serenity theme) can I do that without creating and uploading sidebar2.php?

      Reply
  71. katana leigh
    katana leigh Published |

    How do I tell the stylesheet what to do with the new widgets? They are all floating off center.

    I would like to style them now :D

    Reply
  72. Anna Lam
    Anna Lam Published |

    Awesome tutorial! This tutorial was very easy to follow and saved me from hours of stress.

    Reply
  73. Evgeny
    Evgeny Published |

    Good post!

    Reply
  74. pieter goosen
    pieter goosen Published |

    Excellent article. Good to know I’m doing thinks the way it should be done.

    I’ve got one question, I’ve registered a new sidebar and created a file called sidebar-main.php. I’m currently working on a childtheme of twenty twelve. Is there a way I can change get_sidebar() to get_sidebar( ‘main’ ) without copying all the relevent files to my child theme and editing thing, something I can use in my functions.php file

    Many thanks

    Reply
  75. 13 Great Sites for WordPress Tips, Tutorials, and Hacks | mStudiosTALK
  76. vikas yadav
    vikas yadav Published |

    Amazing tutorial. Just in first para I knew this is the one talking about the right approach towards widgets. Even weekly theme that came is messed up with top , middle, bottom widget area…why do you need three areas in the same sidebar template?
    At the end though, you did not share how to convert the badly written hard coded php in sidebar.php and move it into a proper set of widgets that can then be dragged and positioned neatly….

    Reply
  77. Tabarak Siyal
    Tabarak Siyal Published |

    Hey!

    Ive register a sidebar with this code:

    register_sidebar( array(
    		'name' => __( 'Home Page', 'twentytwelve' ),
    		'id' => 'homepage',
    		'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve' ),
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '',
    		'after_title' => '',
    	) );

    then created a sidebar template with this code

    Now i am using this code for the side bar display

    I can use it in the header or home page template but i cant see this in the footer area, please help me in that.

    Reply
  78. nikki
    nikki Published |

    Just wanted to say what a well written post this is! Stumbled across this whilst looking for the best way to approach custom sidebars and will definitely be adding to my favourites!

    Thanks :)

    Reply
  79. Sidu_88
    Sidu_88 Published |

    Hi everyone

    I’m trying to call a category sidebar for single posts that are listed under that particular category. Lets say a single post ‘Diet Coke Is Awesome’ pulls a sidebar assigned to category ‘Cold Drinks’.

    The other issue is what happens when single posts are listed under more than one category ? Lets say a single post ‘Diet Coke Is Awesome’ also happens to be listed under categories ‘Cold Drinks’ and ‘Discount Supplies’ where ‘Cold Drinks’ and ‘Discount Supplies’ are equal and separate in terms of hierarchy.

    I have sidebar files and implemented them to Categories. I would like to do the same to single posts. Any Insights will be greatly appreciated.

    Thanks

    Reply
  80. Eran Mahalu
    Eran Mahalu Published |

    Pardon my ignorance, but I’m trying to understand the correct syntax for the before_widget and after_widget areas.

    All i want to do is have an image after every widget. could you please explain a dummy how to write it down? :)

    Reply
  81. Reuben Chovuchovu
    Reuben Chovuchovu Published |

    The date today is 24 September 2013 and this tutorial is still as relevant today as it was back in 2010. Job well done.

    Reply
  82. Joe DiFalco
    Joe DiFalco Published |

    Great post.

    I am a mid-level WP developer and have been struggling with the following:

    Using a multisite install, in the default theme for a new blog I configured a child theme.

    I want to override the widgets that are actually placed in the primary sidebar as a default so when the user logs into their blog, I only want the search widget to appear in the sidebar. They can add widgets later, but I want it to default to just contain the search box. I can’t seem to pinpoint where the sidebars are actually populated with widgets.

    While I am at it, and this is off topic a bit but this has been bugging me as well, do you know how to set the default for a new blog to have a static front page as opposed to recent blogs?

    Thanks for sharing your knowledge, much appreciated!!

    Reply
  83. WordPress 技巧大全 | WordPress Tips
    WordPress 技巧大全 | WordPress Tips at |
  84. Wordpress Theming | Pearltrees
    Wordpress Theming | Pearltrees at |
  85. Bruno
    Bruno Published |

    Somehow the %1$s variables are not being substituted … in my html just appears

    <div id="widget-%1$s"> instead of <div id="widget-1">, <div id="widget-2"> and so on…

    :(

    Reply
  86. Spike » iNove theme: just one widget position on right sidebar
  87. Dave
    Dave Published |

    Useful post, saved some time.

    Thanx

    Reply
  88. WordPress | Pearltrees
    WordPress | Pearltrees at |
  89. Alkar
    Alkar Published |

    Самое подробное объяснение, которое я встречал.

    The most detailed explanation I’ve ever met.

    Great thanks.

    Reply
  90. wordpress24.net » Creating a WordPress Theme from Static HTML – Creating a Page Template
  91. Creating a WordPress Theme from Static HTML – Creating a Page Template | Tech Tips
  92. Creating a WordPress Theme from Static HTML - Creating a Page Template | Your Web App
  93. Mike Lagan
    Mike Lagan Published |

    After numerous hours scanning Codex and user blogs at last someone who can clearly explain the power of Wordpress sidebars with examples from begining to end and how not to code them. As Justin says it is all too easy to do it wrong if you don’t fully understand the basics.

    ps: Don’t misunderstand critism of Codex. It is an excellent reference but often falls short of full examples.

    Reply

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.

css.php