WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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:


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

Your Answer


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.