Salve
Sto seguendo alcune lezioni per imparare a progettare temi wordpress ma arrivo alla lezione dei commenti e non funziona tutto correttamente.
Mi spiego il commento sembra che lo inserisca ma vedendo bene lo mette senza parole.
Ho controllato anche in admin e anche li non compare nessun messaggio. Ma se da li inserisco qualcosa e poi do salva funziona tutto correttamente.
codice:
<?php/**
* The template for displaying comments
*
* The area of the page that contains both current comments
* and the comment form.
*
* @package WordPress
* @subpackage WebLab Theme
* @since Weblab Theme 1.0
*/
/*
* 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 if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php
$comments_number = get_comments_number();
if ( '1' === $comments_number ) {
/* translators: %s: post title */
printf( _x( '1 commento a: “%s”', 'comments title', 'weblab' ), get_the_title() );
} else {
printf(
/* translators: 1: number of comments, 2: post title */
_nx(
'%1$s commento a “%2$s”',
'%1$s commenti a “%2$s”',
$comments_number,
'comments title',
'weblab'
),
number_format_i18n( $comments_number ),
get_the_title()
);
}
?>
</h2>
<ol class="comment-list">
<?php
wp_list_comments( array(
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 20,
'max_depth' => '3',
'reply_text' => 'Rispondi <i class="fas fa-long-arrow-alt-right"></i></br></br>',
'per_page' => '4',
) );
?>
</ol><!-- .comment-list -->
<?php endif; // have_comments() ?>
<?php
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'commenti' ) ) :
?>
<p class="no-comments"><?php _e( 'Commenti non disponibili.', 'weblab' ); ?></p>
<?php endif; ?>
<?php
$fields = array(
'author' => '<div class="form-group"><label for="author">Nome*</label>
<input type="text" class="form-control" required="required">
</div>',
'email' => '<div class="form-group"><label for="email">Mail*</label>
<input type="email" class="form-control" required="required">
</div>',
'url' => '<div class="form-group"><label for="url">Sito</label>
<input type="url" class="form-control">
</div>'
);
$args = array(
'fields' => $fields,
'label_submit' => 'Invia',
'class_submit' => 'btn btn-primary',
'title_reply' => 'Vuoi commentare?',
'comment_field' => '<div class="form-group"><label for="comment">Commento</label>
<textarea class="form-control" rows="8"></textarea>
</div>',
);
comment_form($args); ?>
</div><!-- .comments-area -->
Qualcuno può aiutarmi?