Forum Replies Created

Viewing 9 replies - 31 through 39 (of 39 total)
  • Thread Starter theredeclipse

    (@theredeclipse)

    Holy moly, it works now! Thanks a lot!

    Thread Starter theredeclipse

    (@theredeclipse)

    Just noticed I’ve enabled your part of code just above $form_options, but i have been tried above $fields aswell

    Thread Starter theredeclipse

    (@theredeclipse)

    I’ve tried to test it on almost fresh WP installation(just a few plugins were installed but all of them deactivated). With my theme installed it still doesn’t work aswell copied code of comment form into twentyfifteen theme with same result. Maybe I’ve missed something, can you check this hook again with your applied code

     add_filter('comment_form_defaults', 'rapid_comment_form');
    
     
    function rapid_comment_form($form_options)
    {
    
        // Fields Array
        $fields = array(
    
            'author' =>
            '<p>' .
            ( $req ? '<span class="required">*</span>' : '' ) .
            '<input class="block_field_input content_field_input" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' placeholder="' . __( 'Name' ) . '" />' .
            '</p>',
    
            'email' =>
            '<p>' .
            ( $req ? '<span class="required">*</span>' : '' ) .
            '<input class="block_field_input content_field_input" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' placeholder="' . __( 'Email' ) . '" />' .
            '</p>',
    
            'url' =>
            '<p>'  .
            '<input class="block_field_input content_field_input" name="url" size="30" id="url" value="' . esc_attr( $commenter['comment_author_url'] ) . '" type="text" placeholder="' . __( 'Website' ) . '" />' .
            '</p>',
    
        );
    	
    	global $post;
        $req = true;
        $aria_req = '';
        $commenter = array();
        $commenter['comment_author'] = '';
        $commenter['comment_author_email'] = '';
        $commenter['comment_author_url'] = '';
        $post_id = $post->ID;
        $required_text = 'Required';
    
        // Form Options Array
        $form_options = array(
            // Include Fields Array
            'fields' => apply_filters( 'comment_form_default_fields', $fields ),
    
            // Template Options
            'comment_field' =>
            '<textarea id="comment" name="comment" class="block_field_input content_field_input_reply" placeholder="' . _x( 'Комментарий', 'noun' ) . '"></textarea>' ,
    		
    
            'must_log_in' =>
            '<p class="font_2">' .
            sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
                wp_login_url( apply_filters( 'the_permalink', get_permalink($post_id) ) ) ) .
            '</p>',
    
            'logged_in_as' =>
            '<div class="font_2">' .
            sprintf( __( 'Вы вошли как  <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Выйти?</a>' ),
                admin_url('profile.php'),  $current_user, wp_logout_url( apply_filters('the_permalink', get_permalink($post_id)) ) ) .
            '</div></div></div>',
    
            'comment_notes_before' =>
            '<div class="font_2">' .
            __( 'Ваш адрес почты не будет отображен.' ) . ( $req ? $required_text : '' ) .
            '</div></div></div>',
    
            'comment_notes_after' => '',
    
            // Rest of Options
            'id_form' => 'form-comment',
            'id_submit' => 'submit',
            'title_reply' => __( '<div class="font_1">оставить комментарий</div>' ),
            'title_reply_to' => __( '<div class="font_1">ответить %s</div>' ),
            'cancel_reply_link' => __( '<div class="font_2">Отменить</div>' ),
            'label_submit'         => __( 'Post Comment' ),
    		'title_reply_before' => __( '<div class="block_line"><div class="content_header_align">' ),
    		'title_reply_after' => __( '' ),
    		
        );
    
        return $form_options;
    }
    Thread Starter theredeclipse

    (@theredeclipse)

    Oh, I see. Well, form is loading now but still no username. Btw, I have installed bbpress and buddypress, not sure if these modules might be a case just let you know.

    Thread Starter theredeclipse

    (@theredeclipse)

    code should be applied in same spot? I’ve tired this, but it still returns empty reply form :\

    Thread Starter theredeclipse

    (@theredeclipse)

    Unfortunately result is same, comment form doesn’t load.

    Btw, thanks for clarifying regrading usage of functions.php, though I’ve assumed same – just logically a better place for a bunch of code.

    If it may help I can give access to my site, its still in develop so its offline, would do no harm.

    Thread Starter theredeclipse

    (@theredeclipse)

    Oh, I see, I’ve tried to apply this under code with result as blank page. Now tried as you said, as least site loads but “leave a comment” field is not.

    Thread Starter theredeclipse

    (@theredeclipse)

    thanks for the reply. But it doesn’t work, guess I doing something wrong, for my shame I pretty lame with PHP(but its on what I working on) :]

    Can you apply it into my code, I’ll be very appreciated

            'must_log_in' =>
            '<p class="font_2">' .
            sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
                wp_login_url( apply_filters( 'the_permalink', get_permalink($post_id) ) ) ) .
            '</p>',
    Thread Starter theredeclipse

    (@theredeclipse)

    Can you enlighten me how to do it? Tried few variations but it still returns an empty form.

    And tell me please is it worth to move all hooks for a template to functions.php? Or instead of that better to store in a needed file, like comments.php. As I know, functions.php better to use only for needs of selected theme, but what about my_theme_comment and comment_form? It just need to load on a selected page, but functions.php loads with every theme page. Or I am wrong?

Viewing 9 replies - 31 through 39 (of 39 total)