Vous n'êtes pas identifié.
Annonce
Annonce 1 : Le Codex en français a besoin de vous pour avancer !
Annonce 2 : Avant de poster, n'oubliez pas de faire une petite Recherche et de lire les règles de ce forum.
#1 31-03-2008 14:49:10
- Playmobil J
- Habitué WP
- Lieu: Nord
- Date d'inscription: 22-09-2007
- Messages: 91
- Site web
xéparer commentaires et trackback: comment faire.
Bonjour,
Ma configuration WP actuelle
- Version de WordPress : 2.3.3
- Thème utilisé : codrobo
- Plugins en place :
- Nom de l'hebergeur : infomaniak
- Adresse du site :
Problème(s) rencontré(s) :
je trouve que les trackbacks gênent la lisibilité des commentaires. Je voudari les séparer et j'ai donc suivi ce tuto:
http://www.ikiru.ch/blog/2005/separer-p … mmentaires
mais je n'y arrive pas, j'ai des erreurs php.
voici mon fichier comment.php
Code:
- <?php
- /** For some reasons needed one more time **/
- load_theme_textdomain('CordoboGreenPark');
- $aOptions = themeCordoboGreenPark::initOptions(false);
- if (!file_exists(get_theme_root() . '/' . get_template() . '/styles/' . $aOptions['style'])) {
- $aOptions['style'] = 'green';
- }
- // If the style has a header that needs generating, do it.
- $sStyleFolder = get_theme_root() . '/' . get_template() . '/styles/' . $aOptions['style'] . '/';
- ?>
- <div class="comments">
- <div class="comments-nice-bg">
- <div class="comments-nice">
- <?php // Do not delete these lines
- if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
- die ('Please do not load this page directly. Thanks!');
- if (!empty($post->post_password)) { // if there's a password
- if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
- ?>
- <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
- <?php
- return;
- }
- }
- /* This variable is for alternating comment background */
- $oddcomment = 'alt';
- ?>
- <?php if ($comments) : ?>
- <h3 class="reply"><?php comments_number('Aucune Réponse', 'Une Réponse', '% Réponse' );?> pour '<?php the_title(); ?>'</h3>
- <p class="comment_meta">Suivre les commentaires avec <?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr>')); ?>
- <?php if ( pings_open() ) : ?>
- ou faire un <a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack');?></a> pour '<?php the_title(); ?>'.
- <?php endif; ?>
- </p>
- <ol class="commentlist">
- <?php foreach ($comments as $comment) : ?>
- <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
- <div class="comment_author">
- <?php comment_author_link() ?> a dit :
- <?php
- if ( !empty( $comment->comment_author_email ) ) {
- $md5 = md5( $comment->comment_author_email );
- $default = urlencode( 'http://use.perl.org/images/pix.gif' );
- echo "<img style='float: left; margin-left: 10px;' src='http://www.gravatar.com/avatar.php?gravatar_id=$md5&size=60&default=$default' alt='' />";
- }
- ?>
- </div>
- <?php if ($comment->comment_approved == '0') : ?>
- <em>Votre commentaire sera publié après modération.</em>
- <?php endif; ?>
- <br />
- <p class="metadate">le <?php comment_date('j F Y') ?> @ <?php comment_time() ?> <?php edit_comment_link('EDITER',' | ',''); ?></p>
- <?php comment_text() ?>
- </li>
- <?php /* Changes every other comment to a different class */
- if ('alt' == $oddcomment) $oddcomment = '';
- else $oddcomment = 'alt';
- ?>
- <?php endforeach; /* end for each comment */ ?>
- </ol>
- <?php else : // this is displayed if there are no comments so far ?>
- <?php if ('open' == $post-> comment_status) : ?>
- <!-- If comments are open, but there are no comments. -->
- <?php else : // comments are closed ?>
- <!-- If comments are closed. -->
- <div class="postinput">
- <p class="nocomments">Commentaires fermés.</p>
- <?php endif; ?>
- <?php endif; ?>
- <?php if ('open' == $post-> comment_status) : ?>
- <h3 id="reply">Poster un commentaire</h3>
- <div class="postinput">
- <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
- <p>Vous devez etre <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">connecté </a> pour poster un commentaire.</p>
- <?php else : ?>
- <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
- <?php if ( $user_ID ) : ?>
- <p>Connecté comme <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Déconnexion ') ?>">Déconnexion »</a></p>
- <?php else : ?>
- <p>
- <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
- <label for="author"><small>Nom <?php if ($req) _e('(requis)'); ?></small></label></p>
- <p>
- <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
- <label for="email"><small>Mail (ne sera pas publié) <?php if ($req) _e('(requis)'); ?></small></label></p>
- <p>
- <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
- <label for="url"><small>Website</small></label></p>
- <?php endif; ?>
- <p><textarea name="comment" cols="30" rows="5" id="comment" tabindex="4"></textarea></p>
- <p><input name="submit" type="image" id="submit" class="input-submit" tabindex="5" value="Envoyer" title="Relisez vous svp avant de poster" alt="Poster un commentaire" src="<?php bloginfo('stylesheet_directory'); ?>/styles/<?php if (isset($aOptions['style'])) { echo($aOptions['style']); } else { echo('green'); } ?>/images/post-a-comment.png" />
- <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
- </p>
- <?php do_action('comment_form', $post->ID); ?>
- </form>
- <?php endif; // If registration required and not logged in ?>
- <?php endif; // if you delete this the sky will fall on your head ?>
- </div> <!-- /post-input -->
- </div> <!-- /comments-nice -->
- </div> <!-- /comments-nice-bg -->
- </div> <!-- /comments -->
si vous avez une idée...
Hors ligne
#2 31-03-2008 14:59:32
Re: xéparer commentaires et trackback: comment faire.
Et comme ceci ?
http://www.wordpress-fr.net/support/suj … mmentaires
Hors ligne
#3 31-03-2008 15:35:53
- Playmobil J
- Habitué WP
- Lieu: Nord
- Date d'inscription: 22-09-2007
- Messages: 91
- Site web
Re: xéparer commentaires et trackback: comment faire.
k-ny a écrit:
Et comme ceci ?
http://www.wordpress-fr.net/support/suj … mmentaires
ben suis un peu boulet et je n'arrive pas à voir comment transposer dans mon fichier comment.php. Remarque comme j'ai plusieurs thèmes ça veut dire que je vrais refaire la manip...
ça devrait être une fonction natif.
Dernière modification par Playmobil J (31-03-2008 15:37:10)
Hors ligne
#5 13-04-2008 23:38:13
- Playmobil J
- Habitué WP
- Lieu: Nord
- Date d'inscription: 22-09-2007
- Messages: 91
- Site web
Re: xéparer commentaires et trackback: comment faire.
jbj a écrit:
La réponse est ici, mon ami
Merci, mais ton code tu le mets où et dans quel fichier?
Hors ligne
#6 04-05-2008 13:35:17
Re: xéparer commentaires et trackback: comment faire.
Tout ceci est surement très efficace mais il y a plus simple (Spéciale dédicace à Bertrand Renard) :
Il existe le plugin BM-TrackPing qui permet de séparer tranquillement commentaires et trackbacks 
La preuve en image, les trackbacks s'affichent en bas de page sous les commentaires .
Hors ligne
#7 04-05-2008 20:50:17
- luneland
- Connaisseur WP
- Date d'inscription: 15-11-2007
- Messages: 16
Re: xéparer commentaires et trackback: comment faire.
J'ai testé plusieurs solutions sans résultat et j'ai fini par trouvé ce code mais je ne sais plu ou ;(
Voilà le code a mettre dans un fichier que tu renomme "comments.php" et que tu mets dans ton thème, chez moi il fonctionne a merveille.
Code:
- <?php // Do not delete these lines
- if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
- die ('Please do not load this page directly. Thanks!');
- if (!empty($post->post_password)) { // if there's a password
- if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
- ?>
- <p class="nocomments">Entrez le mot de passe pour regarder des commentaires.</p>
- <?php
- return;
- }
- }
- /* This variable is for alternating comment background */
- $oddcomment = 'alt';
- ?>
- <?php
- global $bm_comments;
- global $bm_trackbacks;
- split_comments( $comments );
- ?>
- <!-- You can start editing here. -->
- <?php if ($comments) : ?>
- <?php
- $trackbackcounter = count( $bm_trackbacks );
- $commentcounter = count( $bm_comments );
- ?>
- <h3 class="Style1"><?php echo $commentcounter; ?> Commentaires</h3>
- <ol class="commentlist">
- <?php $cmntCnt = 1; ?>
- <?php foreach ($bm_comments as $comment) : ?>
- <li class="<?php echo $oddcomment; ?> <?php if(function_exists("author_highlight")) author_highlight(); ?>" id="comment-<?php comment_ID() ?>">
- <span class="author_photo"><?php if(function_exists("MyAvatars")) MyAvatars(); ?> </span><?php ck_display_karma(); ?>
- <h6><?php echo($cmntCnt++); ?></h6>
- <cite><?php comment_author_link() ?></cite> a écrit:
- <?php if ($comment->comment_approved == '0') : ?>
- <em>Votre commentaire est en attente de modération.</em>
- <?php endif; ?>
- <br />
- <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('j F, Y') ?> à <?php comment_time() ?></a> <?php edit_comment_link('- Editer','',''); ?></small>
- <?php comment_text() ?>
- </li>
- <?php /* Changes every other comment to a different class */
- if ('alt' == $oddcomment) $oddcomment = '';
- else $oddcomment = 'alt';
- ?>
- <?php endforeach; /* end for each comment */ ?>
- </ol>
- <?php if ( count( $bm_trackbacks ) > 0 ) { ?>
- <h2 class="commh2"><?php echo $trackbackcounter; ?> Trackbacks pour ce "post"</h2>
- <ol class="commentlist">
- <?php $cmntCnt = 1; ?>
- <?php foreach ($bm_trackbacks as $comment) : ?>
- <li class="<?php echo $oddcomment; ?> <?php if(function_exists("author_highlight")) author_highlight(); ?>" id="comment-<?php comment_ID() ?>">
- <h7><?php echo($cmntCnt++); ?></h7>
- <cite><?php comment_author_link() ?></cite>
- <?php if ($comment->comment_approved == '0') : ?>
- <em>Votre commentaire est en attente de modération.</em>
- <?php endif; ?>
- <br />
- <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""></a> <?php edit_comment_link('Editer','',''); ?></small>
- </li>
- <?php /* Changes every other comment to a different class */
- if ('alt' == $oddcomment) $oddcomment = '';
- else $oddcomment = 'alt';
- ?>
- <?php endforeach; /* end for each comment */ ?>
- </ol>
- <?php } ?>
- <?php else : // this is displayed if there are no comments so far ?>
- <?php if ('open' == $post->comment_status) : ?>
- <!-- If comments are open, but there are no comments. -->
- <?php else : // comments are closed ?>
- <!-- If comments are closed. -->
- <p class="nocomments">Les commentaires sont clos.</p>
- <?php endif; ?>
- <?php endif; ?>
- <?php if ('open' == $post->comment_status) : ?>
- <h2 class="commh2">Lâche ta prose :</h2>
- <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
- <p class="alert">Vous devez être <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">connecté</a> pour voir les commentaires.</p>
- <?php else : ?>
- <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
- <?php if ( $user_ID ) : ?>
- <p>Vous êtes connecté comme :<a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Quitter »</a></p>
- <?php else : ?>
- <p style="padding:10px 0px 10px 0px;"><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
- <label for="author"><small>Nom <?php if ($req) echo "(requis)"; ?></small></label></p>
- <p style="padding:10px 0px 10px 0px;"><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
- <label for="email"><small>Courriel (ne sera pas publié) <?php if ($req) echo "(requis)"; ?></small></label></p>
- <p style="padding:10px 0px 10px 0px;"><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
- <label for="url"><small>Url</small></label></p>
- <?php endif; ?>
- <!--<p><small><strong>XHTML:</strong> You can use these tags: <?php echo allowed_tags(); ?></small></p>-->
- <div> <?php
- if ( function_exists(cs_print_smilies) ) {
- cs_print_smilies();
- }
- ?> </div>
- <p style="padding:10px 0px 10px 0px;"><textarea name="comment" style="width:590px;padding:5px;" rows="10" id="comment" tabindex="4"></textarea>
- </p>
- <p style="padding:10px 0px 10px 0px;"><input name="submit" type="submit" id="submit" tabindex="5" value="Z'y va" />
- <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
- </p>
- <?php do_action('comment_form', $post->ID); ?>
- </form>
- <?php endif; // If registration required and not logged in ?>
- <?php endif; // if you delete this the sky will fall on your head ?>
Voila j'espère que cela te servira 
Dernière modification par luneland (04-05-2008 20:52:55)
Hors ligne
#8 06-05-2008 11:19:37
- Playmobil J
- Habitué WP
- Lieu: Nord
- Date d'inscription: 22-09-2007
- Messages: 91
- Site web
Re: xéparer commentaires et trackback: comment faire.
wolforg a écrit:
Tout ceci est surement très efficace mais il y a plus simple (Spéciale dédicace à Bertrand Renard) :
Il existe le plugin BM-TrackPing qui permet de séparer tranquillement commentaires et trackbacks
La preuve en image, les trackbacks s'affichent en bas de page sous les commentaires .
salut,
merci, c'est simple et ça marche!

Hors ligne







