Mettre formulaire commentaire au dessus des commentaires postés
Résolu
Cocochouette
Messages postés
24
Statut
Membre
-
Cocochouette Messages postés 24 Statut Membre -
Cocochouette Messages postés 24 Statut Membre -
Bonjour,
Voila, je n'arrive a trouver les lignes qui correspondent au formulaire de commentaire (sur wordpress) afin des les remontés tout en haut. De façon a mettre le formulaire avant les commentaires qui ont été postés. POurriez vous m'aider ? s'il vous plait.
Voici le code de la page comments.php
<?php /* Comments Template */
if (post_password_required()) {
return;
}
$comments_by_type = separate_comments($comments);
if (have_comments()) {
if (!empty($comments_by_type['comment'])) {
$comment_count = count($comments_by_type['comment']);
($comment_count !== 1) ? $comment_text = __('Comments', 'mh-magazine-lite') : $comment_text = __('Comment', 'mh-magazine-lite'); ?>
<h4 class="section-title"><?php echo $comment_count . ' ' . $comment_text . __(' on ', 'mh-magazine-lite') . get_the_title(); ?></h4>
<ol class="commentlist">
<?php echo wp_list_comments('callback=mh_comments&type=comment'); ?>
</ol><?php
}
if (get_comments_number() > get_option('comments_per_page')) { ?>
<div class="comments-pagination">
<?php paginate_comments_links(array('prev_text' => __('«', 'mh-magazine-lite'), 'next_text' => __('»', 'mh-magazine-lite'))); ?>
</div><?php
}
if (!empty($comments_by_type['pings'])) {
$pings = $comments_by_type['pings'];
$ping_count = count($comments_by_type['pings']); ?>
<h4 class="section-title"><?php echo $ping_count . ' ' . __('Trackbacks & Pingbacks', 'mh-magazine-lite'); ?></h4>
<ol class="pinglist">
<?php foreach ($pings as $ping) { ?>
<li class="pings"><?php echo get_comment_author_link($ping); ?></li>
<?php } ?>
</ol><?php
}
if (!comments_open()) { ?>
<p class="no-comments"><?php _e('Comments are closed.', 'mh-magazine-lite'); ?></p><?php
}
}
if (comments_open()) {
$custom_args = array(
'title_reply' => __('Leave a comment', 'mh-magazine-lite'),
'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.', 'mh-magazine-lite') . '</p>',
'comment_notes_after' => '',
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Comment', 'mh-magazine-lite') . '</label><br/><textarea id="comment" name="comment" cols="45" rows="5" aria-required="true"></textarea></p>');
comment_form($custom_args);
}
?>
Voila, je n'arrive a trouver les lignes qui correspondent au formulaire de commentaire (sur wordpress) afin des les remontés tout en haut. De façon a mettre le formulaire avant les commentaires qui ont été postés. POurriez vous m'aider ? s'il vous plait.
Voici le code de la page comments.php
<?php /* Comments Template */
if (post_password_required()) {
return;
}
$comments_by_type = separate_comments($comments);
if (have_comments()) {
if (!empty($comments_by_type['comment'])) {
$comment_count = count($comments_by_type['comment']);
($comment_count !== 1) ? $comment_text = __('Comments', 'mh-magazine-lite') : $comment_text = __('Comment', 'mh-magazine-lite'); ?>
<h4 class="section-title"><?php echo $comment_count . ' ' . $comment_text . __(' on ', 'mh-magazine-lite') . get_the_title(); ?></h4>
<ol class="commentlist">
<?php echo wp_list_comments('callback=mh_comments&type=comment'); ?>
</ol><?php
}
if (get_comments_number() > get_option('comments_per_page')) { ?>
<div class="comments-pagination">
<?php paginate_comments_links(array('prev_text' => __('«', 'mh-magazine-lite'), 'next_text' => __('»', 'mh-magazine-lite'))); ?>
</div><?php
}
if (!empty($comments_by_type['pings'])) {
$pings = $comments_by_type['pings'];
$ping_count = count($comments_by_type['pings']); ?>
<h4 class="section-title"><?php echo $ping_count . ' ' . __('Trackbacks & Pingbacks', 'mh-magazine-lite'); ?></h4>
<ol class="pinglist">
<?php foreach ($pings as $ping) { ?>
<li class="pings"><?php echo get_comment_author_link($ping); ?></li>
<?php } ?>
</ol><?php
}
if (!comments_open()) { ?>
<p class="no-comments"><?php _e('Comments are closed.', 'mh-magazine-lite'); ?></p><?php
}
}
if (comments_open()) {
$custom_args = array(
'title_reply' => __('Leave a comment', 'mh-magazine-lite'),
'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.', 'mh-magazine-lite') . '</p>',
'comment_notes_after' => '',
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Comment', 'mh-magazine-lite') . '</label><br/><textarea id="comment" name="comment" cols="45" rows="5" aria-required="true"></textarea></p>');
comment_form($custom_args);
}
?>
A voir également:
- Mettre formulaire commentaire au dessus des commentaires postés
- Whatsapp formulaire opposition - Guide
- Clément a partagé le fichier mme bovary. il a écrit des commentaires dans le document. quel est le 2e commentaire ? - Guide
- Formulaire de réclamation facebook compte désactivé - Guide
- Impossible de mettre une photo en commentaire facebook - Forum Facebook
- Problème de commentaire - Forum Facebook
1 réponse
Bonjour, je suis pas certain de la solution (et j'ai la flemme de la tester) mais le dernier paragraphe est celui du formulaire
donc logiquement pour le remonter, il faut le mettre avant la ligne qui recherche les commentaires
ou avant la ligne
C'est sans garantie donc fais une sauvegarde du fichier comments.php avant de le modifier, en cas de problème il suffira de remettre la sauvegarde
if (comments_open()) {
$custom_args = array(
'title_reply' => __('Leave a comment', 'mh-magazine-lite'),
'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.', 'mh-magazine-lite') . '</p>',
'comment_notes_after' => '',
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Comment', 'mh-magazine-lite') . '</label><br/><textarea id="comment" name="comment" cols="45" rows="5" aria-required="true"></textarea></p>');
comment_form($custom_args);
}
donc logiquement pour le remonter, il faut le mettre avant la ligne qui recherche les commentaires
if (have_comments()) {
ou avant la ligne
$comments_by_type = separate_comments($comments);
C'est sans garantie donc fais une sauvegarde du fichier comments.php avant de le modifier, en cas de problème il suffira de remettre la sauvegarde
Cocochouette
Messages postés
24
Statut
Membre
Super, ça marche. Merci beaucoup :)