Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

IS it possible to make every Widget on Wordpress in a different .php file?

I have one page that contains 12 elements, I want to make each of them
a Widget so it would be easier to manage/edit them later on, but it would be better
if it's from a php page rather then from a code block on the Admin panel.

share|improve this question
    
ok, pointless down voting –  Asaf Apr 13 '11 at 10:14
add comment

1 Answer

up vote 1 down vote accepted

If the 12 elements are static HTML, you can just create 12 text widgets.

If they're not, it depends on what you mean by "easy to manage". I, for one, prefer to be able to easily manage my code via SVN. Using widgets obscures that.

If you just want them to be in separate files, just make separate files, put them in their own folder and include them:

include './sidebar/part-1.php';
include './sidebar/part-2.php';

If you're sure you really want widgets, wrap the code in the files mentioned previously in classes, as described here:

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

share|improve this answer
    
They're not static HTML unfortunately –  Asaf Apr 13 '11 at 7:53
    
See updated answer. –  scribu Apr 13 '11 at 11:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.