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 23-03-2008 23:47:51
Doublon de trackback dans les commentaires
Bonjour,
Ma configuration WP actuelle
- Version de WordPress : 2.3.3
- Thème utilisé : Gossip City
- Nom de l'hebergeur : Free.fr
- Adresse du site : http://saint.maur.c.est.fou.free.fr
Problème(s) rencontré(s) :
Le problème peut être visible ici.
Sur le site, les trackbacks sont différenciés des commentaires... enfin normalement ! En effet, on voit bien avant les commentaires les trackbacks dans la section "trackbacks" en mauve. Seulement dans les commentaires qui suivent, on retrouve le lien de trackbacks avec un résumé de l'article en question qui apparait aussi tel un commentaire. Comment le supprimer d'ici afin de ne conserver que le lien dans la zone mauve au dessus... et seulement celui-ci.
Je ne suis pas parvenu à trouver le code qui pose problème dans le thème.
Que la Force soit avec vous...
Hors ligne
#2 25-03-2008 19:15:45
Re: Doublon de trackback dans les commentaires
J'ai épluché mon fichier comments.php mais je ne vois pas où modifier ce paramètre... je pense pourtant que c'est dans ce fichier là qu'il faut agir...
Qu'en pensez-vous ?
Voici pour info mon fichier comments.php :
Code: php
- <div class="Comments">
- <div class="List">
- <!-- Start CommentsList-->
- <?php // Do not delete these lines
- if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
- ?>
- <p class="nocomments">Cet article est protégé. Entrez le mot de passe pour lire l'article et ses commentaires.<p>
- <?php return; }}?>
- <!-- You can start editing here. -->
- <?php if ($comments) : ?>
- <h3 id="comments"><?php comments_number('0 commentaire', '1 commentaire', '% commentaires' );?> pour "<?php the_title(); ?>"</h3>
- <ol>
- <?php foreach ($comments as $comment) : ?>
- <li class="ComListLi" id="comment-<?php comment_ID() ?>">
- <div class="ComListLiTop">
- <?php if (function_exists('gravatar')) { ?>
- <span class="ListGrav">
- <img src="<?php gravatar("R", 40); ?>" alt="<?php comment_author() ?>"/>
- </span>
- <?php } ?>
- <big><?php comment_author_link() ?></big>
- <small><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('j F Y') ?> à <?php comment_time() ?><?php edit_comment_link(' <strong>Modifier</strong>','',''); ?></a></small>
- <span class="ListNr"><? // php gravatar() ?><?php $commentNumber++; echo $commentNumber; ?></span>
- </div>
- <span class="ListContent">
- <p><?php comment_text() ?></p>
- </span>
- <?php if ($comment->comment_approved == '0') : ?>Votre commentaire est en attente de modération.
- </li>
- <?php endif; ?>
- <?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. -->
- <p class="nocomments">Les commentaires sont fermés.</p>
- <?php endif; ?>
- <?php endif; ?>
- <?php if ('open' == $post->comment_status) : ?><br />
- <!-- Ends CommentsList-->
- </div>
- <!-- Start Comments Form-->
- <h3 id="respond">Laissez un commentaire</h3>
- <div class="Form"><div class="FormTop"></div>
- <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
- <p>Vous devez être <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">connecté</a> pour publier 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 style="display: block; margin-top: 5px; font-size: 10px; font-weight: bold;">Connecté en tant que <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&eaute;connexion de ce compte') ?>">Déconnexion »</a>
- </p>
- <br clear="all" />
- <?php else : ?>
- <p>
- <label for="author">
- <small>Nom <?php if ($req) _e('(<strong>*</strong>)'); ?></small>
- <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1" class="TextField" style="width: 400px;" />
- </label>
- </p>
- <p>
- <label for="email">
- <small>E-mail (<?php if ($req) _e('<strong>*</strong>'); ?>)</small>
- <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" class="TextField" style="width: 400px;" />
- </label>
- </p>
- <p>
- <label for="url">
- <small><abbr title="Uniform Resource Identifier">URI</abbr></small>
- <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" class="TextField" style="width: 400px;" />
- </label>
- </p>
- <p>
- <label for="message"><small>Message</small>
- <?php endif; ?>
- <textarea name="comment" id="comment" rows="10" tabindex="4" cols="10" class="TextArea" style="width: 400px;"></textarea>
- </label>
- </p>
- <p><input name="SubmitComment" type="image" class="SubmitComment" onmouseover="javascript:changeSty('SubmitCommentIE');" onmouseout="javascript:changeSty('SubmitComment');" title="Validez votre commentaire" src="<?php bloginfo('template_url'); ?>/images/ButtonTransparent.png" alt="Validez" />
- <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>
- </div>
Que la Force soit avec vous...
Hors ligne
#3 25-03-2008 20:48:20
Re: Doublon de trackback dans les commentaires
Perso moi je fais 2 boucle sur les commentaire, la 1ère pour les tracback commence comme ceci:
Code: php
- <?php foreach ($comments as $comment) :
- $comment_type = get_comment_type();
- if($comment_type != 'comment') { ?>
- <!-- ici le formatage des trackbak -->
- <?php }
- endforeach; ?>
Et ensuite pour les commentaires:
Code: php
- <?php foreach ($comments as $comment) :
- $comment_type = get_comment_type();
- if($comment_type == 'comment') { ?>
- <!-- ici le formatage des commentaires -->
- <?php }
- endforeach; ?>
Voilà comme ça pas de soucis 
Dernière modification par k-ny (25-03-2008 20:49:18)
Hors ligne
#6 27-03-2008 20:45:44
Re: Doublon de trackback dans les commentaires
Waoh... en effet, je n'ai pas encore l'oeil expert du codeur ! 
Et donc ces codes, je les mets à la suite de cette ligne dans mon fichier comments.php ?
Code: php
- <?php foreach ($comments as $comment) : ?>
Que la Force soit avec vous...
Hors ligne
#7 27-03-2008 23:48:04
Re: Doublon de trackback dans les commentaires
Oui, en fait tu remplaces cette boucle (qui commence donc par foreach et fini par endforeach):
Code: php
- <?php foreach ($comments as $comment) : ?>
- <li class="ComListLi" id="comment-<?php comment_ID() ?>">
- <div class="ComListLiTop">
- <span class="ListGrav">
- <img src="<?php gravatar("R", 40); ?>" alt="<?php comment_author() ?>"/>
- </span>
- <?php } ?>
- <big><?php comment_author_link() ?></big>
- <small><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('j F Y') ?> à <?php comment_time() ?><?php edit_comment_link(' <strong>Modifier</strong>','',''); ?></a></small>
- <span class="ListNr"><? // php gravatar() ?><?php $commentNumber++; echo $commentNumber; ?></span>
- </div>
- <span class="ListContent">
- <p><?php comment_text() ?></p>
- </span>
- <?php if ($comment->comment_approved == '0') : ?>Votre commentaire est en attente de modération.
- </li>
- <?php endif; ?>
- <?php endforeach; /* end for each comment */ ?>
Par:
Code: php
- <?php foreach ($comments as $comment) :
- $comment_type = get_comment_type();
- if($comment_type == 'comment') { ?>
- <li class="ComListLi" id="comment-<?php comment_ID() ?>">
- <div class="ComListLiTop">
- <span class="ListGrav">
- <img src="<?php gravatar("R", 40); ?>" alt="<?php comment_author() ?>"/>
- </span>
- <?php } ?>
- <big><?php comment_author_link() ?></big>
- <small><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('j F Y') ?> à <?php comment_time() ?><?php edit_comment_link(' <strong>Modifier</strong>','',''); ?></a></small>
- <span class="ListNr"><? // php gravatar() ?><?php $commentNumber++; echo $commentNumber; ?></span>
- </div>
- <span class="ListContent">
- <p><?php comment_text() ?></p>
- </span>
- <?php if ($comment->comment_approved == '0') : ?>Votre commentaire est en attente de modération.
- </li>
- <?php endif; ?>
- <?php endforeach; /* end for each comment */ ?>
Et juste après (ou avant) tu ajoute l'autre boucle et la tu personnalise la structure html de tes trackback :
Code: php
- <?php foreach ($comments as $comment) :
- $comment_type = get_comment_type();
- if($comment_type != 'comment') { ?>
- <!-- ici le formatage des trackbak -->
- <?php }
- endforeach; ?>
Comme ça s'est séparer et personnalisé, clair et net !
Hors ligne
#8 27-04-2008 16:58:57
Re: Doublon de trackback dans les commentaires
Bon je suis vraiment pas doué, je n'arrive pas à mettre cela en place, j'obtiens toujours un message d'erreur lorsqu'il tente d'afficher les commentaires après les trackbacks.
Dois-je avoir qu'un seul endforeach ou un pour chaque boucle ? et comment faire pour mettre les 2 boucles à la suite... en fait c'est cela que je dois mal faire...
Que la Force soit avec vous...
Hors ligne







