Advent Calendar – 24 Days Tips And Tricks Each Day! Today: WordPress Comment Form Widget


Especially in Germany we have the tradition of an Advent Calendar. An Advent calendar is a special calendar which is used to count down the days from December the 1st to Christmas Eve December 24th.

An Advent Calendar has 24 doors, one of which is opened every day during Advent. Each door opens to reveal an image, a poem, or part of a story such as the Nativity story itself. More elaborate Advent calendars have a small gift concealed in each door, such as a toy or a chocolate item.

At WP Engineer, we thought we should do the same and open a door every day, which contains a little gift for our readers, by providing them a WordPress tip or trick each day. So we hope you will be exciting to see what tip, hack or news will be behind the door the next morning. Enjoy a new little WordPress gift every day until December 24th. 🙂

Our first little gift is a code snippet to implement the commentform as a widget in your sidebar. This Widget only works with WordPress 2.8 and higher since it’s using the new Widget API. Just paste the code in the functions.php of your theme and drag the Widget on your sidebar.

class wpe_comment_widget extends WP_Widget {

    function wpe_comment_widget() {
        $widget_ops = array('classname' => 'wpe_widget_comments', 'description' => __( 'Your comments and commentform', 'your_textdomain') );
        $this->WP_Widget('wpe-comment-widget', __('WPE Comments', 'your_textdomain'), $widget_ops);

    function widget($args, $instance) {
        if(is_single()) {
            global $post;
            echo $before_widget;
            echo $after_widget;

    function update($new_instance, $old_instance) {
        $instance = $old_instance;
        return $instance;

    function form($instance) {
        <p><?php _e('This widget will only be displayed in single view.', 'your_textdomain'); ?></p>






6 responses to “Advent Calendar – 24 Days Tips And Tricks Each Day! Today: WordPress Comment Form Widget”

  1. […] den WP Engineer Christmas Advent Calendar habe ich ein Widget gebaut, mit dem man die Kommentare und das Kommentarformular in der Sidebar […]

  2. Adventskalender im Internet (2. Update)…

    Es ist ja bald wieder Weihnachten. Daher gibt es im Internet wieder zahlreiche Adventskalender, die Geschenke oder vergünstige Angebote bieten. Im Folgenden werde ich die vorstellen, über die ich gestolpert bin:
    Informatives und lehrreiches:


  3. […] Adventskalender von (dahinter stehen ein paar deutsche Blogger) widmet sich jeden Tag WordPress/PHP […]

  4. […] ebenso zu der Idee des Adventskalenders begeistern und daher wird es auch bei WP Engineer einen Kalender zur Weihnachtszeit geben; lasst euch überraschen. Artikel #1051, 30. November 2009 · Allgemein, Webküche, […]

  5. abdullah.okm Avatar

    This is very helpful post.
    Thank you.

  6. […] kommt noch der Dezember mit dem WP Engineer Advent Calendar. Also Langeweile habe ich […]