-1

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.

1
  • ok, pointless down voting
    – Asaf
    Apr 13, 2011 at 10:14

1 Answer 1

1

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

2
  • They're not static HTML unfortunately
    – Asaf
    Apr 13, 2011 at 7:53
  • See updated answer.
    – scribu
    Apr 13, 2011 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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