Posted By

mrwolfgraphics on 11/30/10


Tagged


Versions (?)

WordPress Comment Form Widget


 / Published in: PHP
 

URL: http://wpengineer.com/1875/advent-calendar-24-days-tips-and-tricks-each-day-today-wordpress-comment-form-widget/

  1. <?php
  2. class wpe_comment_widget extends WP_Widget {
  3. function wpe_comment_widget() {
  4. $widget_ops = array('classname' => 'wpe_widget_comments', 'description' => __( 'Your comments and commentform', 'your_textdomain') );
  5. $this->WP_Widget('wpe-comment-widget', __('WPE Comments', 'your_textdomain'), $widget_ops);
  6. }
  7. function widget($args, $instance) {
  8. if(is_single()) {
  9. extract($args);
  10. global $post;
  11. echo $before_widget;
  12. comments_template();
  13. echo $after_widget;
  14. }
  15. }
  16. function update($new_instance, $old_instance) {
  17. $instance = $old_instance;
  18. return $instance;
  19. }
  20. function form($instance) {
  21. ?>
  22. <p><?php _e('This widget will only be displayed in single view.', 'your_textdomain'); ?></p>
  23. <?php
  24. }
  25. }
  26. register_widget('wpe_comment_widget');
  27. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: robertfcrocker on September 14, 2017

I appreciate everything you have added to my knowledge base.Admiring the time and effort you put into your blog and detailed information you offer.Thanks. more information

You need to login to post a comment.