[wp-trac] [WordPress Trac] #34731: Need method to revert "comment" field position

WordPress Trac noreply at wordpress.org
Thu Nov 19 01:26:59 UTC 2015


#34731: Need method to revert "comment" field position
-------------------------------------------+-----------------------
 Reporter:  greenshady                     |       Owner:  afercia
     Type:  defect (bug)                   |      Status:  assigned
 Priority:  normal                         |   Milestone:  4.4
Component:  Comments                       |     Version:  trunk
 Severity:  normal                         |  Resolution:
 Keywords:  reporter-feedback 2nd-opinion  |     Focuses:
-------------------------------------------+-----------------------

Comment (by greenshady):

 Replying to [comment:4 johnbillion]:
 > Are you seeing particular problems as a result of the change in HTML?
 For example, broken comment form layouts, etc.

 Actually, yes, I have a theme that I designed for a friend where the HTML
 change breaks the comment form design.  That's easily fixable on my part
 though.

 ---

 FWIW, I managed to piece together a plugin that would actually move the
 comment field. It's just a bit weird doing it this way:

 {{{
 <?php

 final class JT_Revert_Comment_Field_Position {

         public $comment_field = '';

         public static function get_instance() {

                 static $instance = null;

                 if ( is_null( $instance ) ) {
                         $instance = new self;
                         $instance->setup_actions();
                 }

                 return $instance;
         }

         private function setup_actions() {

                 // Capture the comment field HTML.
                 add_filter( 'comment_form_field_comment', array( $this,
 'capture_comment_field' ), 999 );

                 // Dirty hack to move the comment field.
                 add_filter( 'comment_form_submit_field', array( $this,
 'hack_in_comment_field' ), 999 );
         }

         public function capture_comment_field( $field ) {

                 $this->comment_field = $field;

                 return '';
         }

         public function hack_in_comment_field( $submit_field ) {

                 if ( $this->comment_field )
                         $submit_field = $this->comment_field .
 $submit_field;

                 return $submit_field;
         }
 }

 JT_Revert_Comment_Field_Position::get_instance();
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34731#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list