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

I'm to implement a theme in wordpress.

Is possible modify a output (html) of widget in wordpress?

For example, the "recent comments widget"?

share|improve this question
up vote 1 down vote accepted

I would copy the widget from the core as needed, put it in the theme or plugin, but you should also unregister the core widget you are replacing.

That can be done like this:

// unregister all default WP Widgets
function unregister_default_wp_widgets() {
add_action('widgets_init', 'unregister_default_wp_widgets', 1);

Then register your new widget and you should be all set.

If you just need to change the aesthetics of a widget and not the functionality - you could try using Javascript to manipulate the elements as needed.

share|improve this answer

Yes, you can modify the output of the widget, but not by modifying core files. What I would do is, go into the wp-includes/default-widgets.php and copy the entire widget code and rewrite it as you need it. I would also then paste the following into your functions.php file. That way the WP default one doesn't show up in the admin. Also, make sure to use a different class name for the new widget.

wp_unregister_sidebar_widget( 'recent-posts' );
share|improve this answer

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.