- Home
- Categorie
- Coding e Sistemistica
- WordPress
- Modificare etichette form commenti a seconda del contenuto
-
Modificare etichette form commenti a seconda del contenuto
Sicuramente dal titolo avrete capito poco o nulla...
In pratica voglio trasformare una pagina in una sorta di bacheca, abilitandone i commenti.
Purtroppo le etichette del form (lascia un commento, invia il tuo commento, ecc.) sono adatte agli articoli e meno a quel che occorre a me.
Cercavo, quindi, il sistema per diversificarle utilizzando delle altre espressioni.
L'idea che mi è venuta è stata quella di creare un nuovo template nel quale poi incorporare il comments.php
Purtroppo però sostituendo a
<?php comments_template(); ?>
il contenuto del file comments.php non ottengo un errore ma scompare la visualizzazione dei commenti già inseriti.Sto sbagliando da qualche parte? E' impossibile da realizzare? Esiste qualche plugin in merito?
Ditemi voi...Grazie per l'attenzione e ciao...
bacheca.php
<?php /* Template Name: Bacheca */ ?> <?php get_header(); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <!-- post --> <div <?php post_class('post'); ?> id="post-<?php the_ID(); ?>"> <h1 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1> <div class="post-text"> <?php the_content(__('Read the full post','comet').' »'); wp_link_pages('before=<div class="post-pages">'.__('Pages','comet').':&after=</div>&next_or_number=number&pagelink=<span>%</span>'); ?> </div> <div class="post-meta"> <div class="row"> <?php if ( comments_open() ) { ?> <div class="alignright"><?php comments_popup_link(__('No Comments','comet'),__('1 Comment','comet'),__('% Comments','comet')); ?></div> <?php } ?> <?php edit_post_link(__('Edit Post','comet'), ' • ', ''); ?> </div> </div> </div> <!--/post --> <div class="sep"></div> <?php comments_template(); ?> <?php endwhile; ?> <?php else : ?> <div class="post"> <h1 class="post-title"><?php _e('Page not found','comet'); ?></h1> <div class="post-text"> <p><?php _e('The page you were looking for could not be found.','comet'); ?></p> </div> </div> <?php endif; ?> <?php get_footer(); ?> ```comments.php
<!-- #comments -->
<div id="comments"><?php
if ( post_password_required() ) {_e('This post is password protected. Enter the password to view any comments.','comet'); echo "</div><!-- -->"; return;
}
// we have comments
if ( have_comments() ) { ?><a href="#respond" class="alignright leave-one"><?php _e('Leave a comment','comet'); ?></a> <h3 class="comment-heading post-title"><?php comments_number(__('No Comments','comet'),__('1 Comment','comet'),__( '% Comments','comet') );?></h3> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) { ?> <div class="navigation"> <?php paginate_comments_links() ?> </div> <?php } ?> <ol class="commentlist"> <?php wp_list_comments('type=comment&callback=fp_comments'); ?> </ol> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) { ?> <div class="navigation"> <?php paginate_comments_links() ?> </div> <?php } ?> <ol class="trackbacklist"> <?php wp_list_comments('type=pingback&callback=fp_trackbacks'); ?> </ol>
<?php
// we dont have comments
} else {// comments are closed if ( ! comments_open() && ! is_page() ) { _e('Comments are closed.','comet'); }
}
// comment form
if ( function_exists('comment_form') ) {comment_form();
} else { // using WordPress lower than 3.0
if ('open' == $post->comment_status) { ?> <h2 class="comment-heading post-title"><?php comment_form_title(); ?></h2> <div id="respond"> <?php if ( get_option('comment_registration') && !$user_ID ) { ?> <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p> <?php } else { ?> <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <div class="cancel-comment-reply"> <p><?php cancel_comment_reply_link(); ?></p> </div> <?php if ( $user_ID ) { ?> <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a></p> <p><a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out »</a></p> <?php } else { ?> <p class="comment-form-author"> <label for="author">Name</label> <span class="required">*</span> <input id="author" name="author" type="text" value="<?php echo $comment_author; ?>" size="30" <?php if ($req) echo "aria-required='true'"; ?> /> </p> <p class="comment-form-email"> <label for="email">Email</label> <span class="required">*</span> <input id="email" name="email" type="text" value="<?php echo $comment_author_email; ?>" size="30" <?php if ($req) echo "aria-required='true'"; ?> /> </p> <p class="comment-form-url"> <label for="url">Website</label> <input id="url" name="url" type="text" value="<?php echo $comment_author_url; ?>" size="30" /> </p> <?php } ?> <p class="comment-form-comment"> <label for="comment">Comment</label> <textarea id="comment" name="comment" cols="45" rows="8"></textarea> </p> <p class="form-allowed-tags"> You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <code><a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> </code> </p> <p class="form-submit"> <input name="submit" type="submit" id="submit" value="Post Comment" /> <?php comment_id_fields(); ?> </p> <?php do_action('comment_form', $post->ID); ?> </form><!-- /commentform --> <?php } // If registration required and not logged in ?> </div><!-- /respond -->
<?php
}} // if you delete this the sky will fall on your head ?>
</div><!-- -->