Title: Custom Widget Template
Last modified: May 21, 2018

---

# Custom Widget Template

 *  Resolved [Ricky Poon](https://wordpress.org/support/users/poonasor/)
 * (@poonasor)
 * [8 years ago](https://wordpress.org/support/topic/custom-widget-template/)
 * Is there a way to create a custom template for the recent ads widget?
 * Thank you

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [8 years ago](https://wordpress.org/support/topic/custom-widget-template/#post-10302868)
 * Hi,
    for the widget itself there isn’t, but you can make a copy of the widget
   by extending the widget class like this
 *     ```
       add_action( 'widgets_init', 'my_widgets_init', 100 );
       function my_widgets_init() {
           class My_Recent_Ads_Widget extends Adverts_Widget_Ads {
               public function widget($args, $instance) {
                   // your custom HTML here
                   return parent::widget($args, $instance);
               }
           }
           unregister_widget( "Adverts_Widget_Ads" );
           register_widget( "My_Recent_Ads_Widget" );
       }
       ```
   
 * Now you will just need to modify the content function widget() returns to display
   your own version of the template.
 *  Thread Starter [Ricky Poon](https://wordpress.org/support/users/poonasor/)
 * (@poonasor)
 * [8 years ago](https://wordpress.org/support/topic/custom-widget-template/#post-10305693)
 * Thank you,
    will this create a new widget? or would it be the same as WPAdverts
   Ads widget? i’ve added the code into functions file but I don’t see a new widget
   registered
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [8 years ago](https://wordpress.org/support/topic/custom-widget-template/#post-10306978)
 * This will just overwrite the original Related Ads widget, by default this code
   does not do anything, you would need to modify the lines
 *     ```
       // your custom HTML here
       return parent::widget($args, $instance);
       ```
   
 * to see the result in the sidebar in the frontend.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom Widget Template’ is closed to new replies.

 * ![](https://ps.w.org/wpadverts/assets/icon-256x256.png?rev=2423472)
 * [WPAdverts - Classifieds Plugin](https://wordpress.org/plugins/wpadverts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpadverts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpadverts/)
 * [Active Topics](https://wordpress.org/support/plugin/wpadverts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpadverts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpadverts/reviews/)

## Tags

 * [custom-template](https://wordpress.org/support/topic-tag/custom-template/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 3 replies
 * 2 participants
 * Last reply from: [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/custom-widget-template/#post-10306978)
 * Status: resolved