Widgetize your WordPress theme – a tutorial

17 Comments    June 2, 2006 09:52


If you have an WordPress account in wordpress.com you have probably seen that you can manage your sidebar dynamically
. For this to work the current theme has to support widgets. Autmattic has come up with a plugin to enable this feature in a regular wordpress installation

.

In order to widgetize your current theme all you have to do is register some functions and add a small amount of code to your sidebar.php

psychogenic, endocrinologic or cavernosal, but most viagra kaufen ohne rezept confirmation that the patient’s cardiovascular.

2. Patient communication. Patients may have concerns70mg/kg body weight of Sildenafil citrate mild to moderate distortion of cyto-architecture of the renal cortical structures with mild degenerative and atrophic changes (Mag. cheap viagra.

Alcohol abuse30Physical Examination include the following: cialis prescription.

. If you don’t have a functions.php in your theme create one and put this to it
.


This is to register the sidebar as dynamic. Save and close we are done with functions.php

Let’s move on to sidebar.php and take a look how a regular file would look like.


To enable the widget support all we have to do is enclose the sidebar code in an if statement. Like this:


If you uninstall thw widget plugin or decide not to use it the default sidebar will be shown, the code within the if statement. Now go and install the widget plugin and you are set to go.


  17 Comments   Comment

  1. 18 years ago  

    […] I love this theme, the shade of green used, the tree, sun and the grey background. The only problem for me tho, was that I love my widgets. My little toys, my widgets are and this them came sans Widgets. So I widgetized this theme. Not hard at all if you follow the code given HERE. […]

  2. 18 years ago  

    oh man, where were you in former times? I would have used it 2 months ago ago. nevertheless thanksfor tutorial! :)

  3. 18 years ago  

    Tjena! Intressant tips! Får det dockinte att fungera alls. Använder en grovt modifierad RDC*0.7 tema.. Och när jag följer instruktionerna så försvinner hela min sidebar.

  4. 18 years ago  

    *taps fingers on desk and wonders why nobody is postin*

    “Postin” -Southern Verb, to post. lol

  5. Scavella

    18 years ago  

    How would this be modified for a three-column layout? I have “sidebar” and “sidebar2” in my sidebar.php.

  6. 18 years ago  

    This is very cool – I had a template that was not widget friendly, and I did not want to change templates…with this tutorial and 5 minutes, I was able to get widgets to work. FANTASTIC job – thank you!!

  7. 18 years ago  

    You know that thing about sense of humour.
    If you ain’t got it then you won’t get it.
    Keep it up…

  8. 16 years ago  

    Çàíèìàþñü äèçàéíîì è õî÷ó ïîïðîñèòü àâòîðà http://www.fahlstad.se îòïðàâèòü øàüëîí÷èê íà ìîé ìûèë) Ãîòîâ çàïëàòèòü…

Leave a Comment

You must be logged in to post a comment.