← Desenvolvimento

Mudar posição de comentários do wordpress

Lida 3391 vezes

Offline

Mister_Magoo 
Membro
Mensagens 594 Gostos 38
Troféus totais: 29
Trófeus: (Ver todos)
Nineth year Anniversary Eighth year Anniversary Quick Poster Signature Level 5 Search Windows User Super Combination Combination Topic Starter

Uso wordpress e queria mudar a posição que é padrão dos comentários que fica no final das postagens.

Exemplo: Um artigo recebeu 22 comentários e o novo leitor precisa descer a barra lateral com os 22 comentários para achar a opção de comentar.

Queria colocar acima dos comentários.
Offline

Octávio Alves 
Membro
Mensagens 963 Gostos 36
Feedback +25

Troféus totais: 27
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Olá Mister_Magoo,

Isso pode ser alterado no ficheiro comments.php, dentro do seu template.

Normalmente, é mais ou menos isso:

Código: [Seleccione]
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true' required" : '' );

$form_args = array(
"title_reply"          => "",
"label_submit"         => __( 'Comment' , 'template_wp' ),
"comment_notes_before" => '',
"comment_notes_after"  => '',
'id_submit'            => 'submitWPComment',
'comment_field'        =>  '<p class="push-down-15"><label for="message">' . __( 'Message' , 'template_wp' ) . ( $req ? ' <span class="warning">*</span>' : '' ) . '</label><textarea class="form-control form-control--contact form-control--big" id="comment" name="comment" rows="7" aria-required="true" placeholder="' . __( 'Write comment...', 'template_wp' ) . '" required>' . '</textarea></p>',
'fields' => array(
'author' => '<p class="push-down-15"><label for="author">' . __( 'Name' , 'template_wp' ) . ( $req ? ' <span class="warning">*</span>' : '' ) . '<input class="form-control  form-control--contact" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></label></p>',
'email' => '<p class="push-down-15"><label for="email">' . __( 'Email' , 'template_wp' ) . ( $req ? ' <span class="warning">*</span>' : '' ) . '<input class="form-control  form-control--contact" id="email" name="email" type="email" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></label></p>',
'url' => '<p class="push-down-15"><label for="url">' . __( 'Website' , 'template_wp' ) . ( $req ? ' <span class="warning">*</span>' : '' ) . '<input class="form-control  form-control--contact" id="url" name="url" type="text" value="' . esc_attr(  $commenter['comment_author_url'] ) . '" size="30" /></label></p>',
)
);

comment_form( $form_args );

Cumprimentos
Octávio Alves
Offline

Mister_Magoo 
Membro
Mensagens 594 Gostos 38
Troféus totais: 29
Trófeus: (Ver todos)
Nineth year Anniversary Eighth year Anniversary Quick Poster Signature Level 5 Search Windows User Super Combination Combination Topic Starter

É bem parecido com esse, porém ainda na dúvida o que eu devo fazer para mudar a posição dele?
Offline

Octávio Alves 
Membro
Mensagens 963 Gostos 36
Feedback +25

Troféus totais: 27
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Basicamente, esse código é o formulário para submeter o comentário.
Por isso, basta mudares essa parte do código de lugar, conforme a posição que pretendas.
Offline

Mister_Magoo 
Membro
Mensagens 594 Gostos 38
Troféus totais: 29
Trófeus: (Ver todos)
Nineth year Anniversary Eighth year Anniversary Quick Poster Signature Level 5 Search Windows User Super Combination Combination Topic Starter

Eu quero que o formulário não fique em baixo quero que fique em cima dos comentários.
Offline

Mister_Magoo 
Membro
Mensagens 594 Gostos 38
Troféus totais: 29
Trófeus: (Ver todos)
Nineth year Anniversary Eighth year Anniversary Quick Poster Signature Level 5 Search Windows User Super Combination Combination Topic Starter

@Octávio Alves algum help?
Offline

bfms 
Equipa
Mensagens 1769 Gostos 40
Feedback +1

Troféus totais: 35
Trófeus: (Ver todos)
Search Level 6 Apple User Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

Publica aqui o código do teu ficheiro comments.php que será mais fácil para te podermos ajudar ;)
Offline

Mister_Magoo 
Membro
Mensagens 594 Gostos 38
Troféus totais: 29
Trófeus: (Ver todos)
Nineth year Anniversary Eighth year Anniversary Quick Poster Signature Level 5 Search Windows User Super Combination Combination Topic Starter

Código: [Seleccione]
<?php
/**
 * The template for displaying comments.
 *
 * The area of the page that contains both current comments
 * and the comment form.
 *
 * @package sparkling
 */

/*
 * If the current post is protected by a password and
 * the visitor has not yet entered the password we will
 * return early without loading the comments.
 */
if ( post_password_required() ) {
return;
}
?>


<div id="comments" class="comments-area">

<?php // You can start editing here -- including this comment! ?>

<?php if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php
printf_nx'One thought on &ldquo;%2$s&rdquo;''%1$s thoughts on &ldquo;%2$s&rdquo;'get_comments_number(), 'comments title''sparkling' ),
number_format_i18nget_comments_number() ), '<span>' get_the_title() . '</span>' );
?>

</h2>

<?php if ( get_comment_pages_count() > && get_option'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-above" class="comment-navigation" role="navigation">
<h1 class="screen-reader-text"><?php esc_html_e'Comment navigation''sparkling' ); ?></h1>
<div class="nav-previous"><?php previous_comments_linkesc_html__'&larr; Older Comments''sparkling' ) ); ?></div>
<div class="nav-next"><?php next_comments_linkesc_html__'Newer Comments &rarr;''sparkling' ) ); ?></div>
</nav><!-- #comment-nav-above -->
<?php endif; // check for comment navigation ?>

<ol class="comment-list">
<?php
wp_list_comments( array(
'style'      => 'ol',
'short_ping' => true,
'avatar_size' => 60
) );
?>

</ol><!-- .comment-list -->

<?php if ( get_comment_pages_count() > && get_option'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-below" class="comment-navigation" role="navigation">
<h1 class="screen-reader-text"><?php esc_html_e'Comment navigation''sparkling' ); ?></h1>
<div class="nav-previous"><?php previous_comments_linkesc_html__'&larr; Older Comments''sparkling' ) ); ?></div>
<div class="nav-next"><?php next_comments_linkesc_html__'Newer Comments &rarr;''sparkling' ) ); ?></div>
</nav><!-- #comment-nav-below -->
<?php endif; // check for comment navigation ?>

<?php endif; // have_comments() ?>

<?php
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() && '0' != get_comments_number() && post_type_supportsget_post_type(), 'comments' ) ) :
?>

<p class="no-comments"><?php esc_html_e'Comments are closed.''sparkling' ); ?></p>
<?php endif; ?>

<?php comment_form(); ?>

</div><!-- #comments -->
Offline

bfms 
Equipa
Mensagens 1769 Gostos 40
Feedback +1

Troféus totais: 35
Trófeus: (Ver todos)
Search Level 6 Apple User Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

Experimenta substituir o conteúdo do teu ficheiro por este código abaixo:

Código: [Seleccione]
<?php
/**
 * The template for displaying comments.
 *
 * The area of the page that contains both current comments
 * and the comment form.
 *
 * @package sparkling
 */

/*
 * If the current post is protected by a password and
 * the visitor has not yet entered the password we will
 * return early without loading the comments.
 */
if ( post_password_required() ) {
return;
}
?>


<div id="comments" class="comments-area">

<?php // You can start editing here -- including this comment! ?>

        <?php comment_form(); ?>

<?php if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php
printf_nx'One thought on &ldquo;%2$s&rdquo;''%1$s thoughts on &ldquo;%2$s&rdquo;'get_comments_number(), 'comments title''sparkling' ),
number_format_i18nget_comments_number() ), '<span>' get_the_title() . '</span>' );
?>

</h2>

<?php if ( get_comment_pages_count() > && get_option'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-above" class="comment-navigation" role="navigation">
<h1 class="screen-reader-text"><?php esc_html_e'Comment navigation''sparkling' ); ?></h1>
<div class="nav-previous"><?php previous_comments_linkesc_html__'&larr; Older Comments''sparkling' ) ); ?></div>
<div class="nav-next"><?php next_comments_linkesc_html__'Newer Comments &rarr;''sparkling' ) ); ?></div>
</nav><!-- #comment-nav-above -->
<?php endif; // check for comment navigation ?>

<ol class="comment-list">
<?php
wp_list_comments( array(
'style'      => 'ol',
'short_ping' => true,
'avatar_size' => 60
) );
?>

</ol><!-- .comment-list -->

<?php if ( get_comment_pages_count() > && get_option'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-below" class="comment-navigation" role="navigation">
<h1 class="screen-reader-text"><?php esc_html_e'Comment navigation''sparkling' ); ?></h1>
<div class="nav-previous"><?php previous_comments_linkesc_html__'&larr; Older Comments''sparkling' ) ); ?></div>
<div class="nav-next"><?php next_comments_linkesc_html__'Newer Comments &rarr;''sparkling' ) ); ?></div>
</nav><!-- #comment-nav-below -->
<?php endif; // check for comment navigation ?>

<?php endif; // have_comments() ?>

<?php
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() && '0' != get_comments_number() && post_type_supportsget_post_type(), 'comments' ) ) :
?>

<p class="no-comments"><?php esc_html_e'Comments are closed.''sparkling' ); ?></p>
<?php endif; ?>

</div><!-- #comments -->

Se não estiver como pretendes, é uma questão de moveres esta linha mais para baixo:

Código: [Seleccione]
<?php comment_form(); ?>
Esta linha é referente ao formulário de inserção de comentários.

Offline

Mister_Magoo 
Membro
Mensagens 594 Gostos 38
Troféus totais: 29
Trófeus: (Ver todos)
Nineth year Anniversary Eighth year Anniversary Quick Poster Signature Level 5 Search Windows User Super Combination Combination Topic Starter

Opa ficou perfeito.

Obrigado