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 there a way I can make text widgets accept PHP? Perhaps something I can add in to functions.php? I'm redesigning my site, and I was wondering why I didn't use widgets at all in my current design, but then I realized it was because I use a lot of PHP in there.

For example, one of the "widgets" is a tabbed content area, so I've got the HTML and JavaScript shell for the tabs, but then inside the tabs, I've got PHP calls for the most popular posts, the most recent posts, and the most recent comments. I can't do that with existing widgets.

Obviously I could use a plugin, but I'm trying to go light on plugins where possible. Is there something I can just add to functions.php?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

PHP in text widgets involves using eval(), which is evil.

If you know PHP, stick with static sidebars.

share|improve this answer
    
That's what I was thinking, but everyone makes it seems like if a theme isn't widget-ready, it's outdated. I have no problems with it though if it's currently the best way to go for what I need to do. Thanks! –  Chris May 30 '11 at 20:13
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.