/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php 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; comments_template(); 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> <?php } } register_widget('wpe_comment_widget'); ?>