Annonce

Important, migration recommandée : WordPress 2.6.3 est disponible en français.À lire avant la migration !
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.
Annonce 3 : Lisez notre blog, il regorge de bonnes informations.

#1 03-07-2008 17:46:18

ClicClac
Connaisseur WP
Lieu: Dijon
Date d'inscription: 05-01-2006
Messages: 48
Site web

Afficher les commentaires dans une box.

Bonjour,

Je cherche à afficher les commentaires dans une box (Thickbox, si possible, que j'utilise par ailleurs).
Si qq'un a une idée...


Ma configuration WP actuelle
- Version de WordPress : 2.5.1

Hors ligne

 

#2 04-07-2008 11:34:13

ClicClac
Connaisseur WP
Lieu: Dijon
Date d'inscription: 05-01-2006
Messages: 48
Site web

Re: Afficher les commentaires dans une box.

En fouillant dans différents thèmes, j'ai trouvé ça:

single_comments.php

Code:

  1. <?php require('../../../wp-blog-header.php');  ?>
  2. <?php //get_header(); ?>
  3. <?php the_post();?>
  4. <?php
  5. //$templatedir = get_bloginfo('template_directory');
  6.  
  7. $comments = $wpdb->get_results('SELECT * FROM '.$wpdb->comments.' WHERE comment_post_ID = \''.$post->ID.'\' AND comment_approved = \'1\' ORDER BY comment_date');
  8.  
  9.  
  10. if ($comments) :
  11. ?>
  12. <ol class="commentlist">
  13. <?php
  14.   foreach ($comments as $comment) : ?>
  15.   <?php $i++; /* For different background colors */
  16.   ($i % 2 == 1) ? $bg_comment = 'class_comment1' : $bg_comment = 'class_comment2';
  17. ?>
  18.  
  19.     <li class="<?php echo $bg_comment; ?>" id="comment-<?php comment_ID() ?>">
  20.      
  21.         <?php echo get_avatar( $comment, 48, $default =  'http://' . $_SERVER['HTTP_HOST'] . '/wordpress/wp-content/themes/photoblog/e030.gif' ); ?>
  22.         <b><?php comment_author_link() ?></b> dit :
  23.         <?php if ($comment->comment_approved == '0') : ?>
  24.         <em>Votre commentaire est en attente de modération.</em>
  25.         <?php endif; ?>
  26.         <br />
  27.         <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>
  28.         <br /><br />
  29.         <?php comment_text() ?>
  30.       </li>
  31.      
  32.       <?php
  33.       /* Changes every other comment to a different class */
  34.       $oddcomment = ( empty( $oddcomment ) ) ? 'class="class_comment2" ' : '';
  35.     endforeach; /* end for each comment */ ?>
  36. </ol>
  37. <!-- end of inline comments //-->
  38. <?php endif; ?>
  39. <?php //get_footer(); ?>

que j'appelle par

Code:

  1. ?php if ($post->comment_count > 0 ) { ?>
  2.             (<a class="thickbox"  title="Commentaire" href="<?php bloginfo(template_directory); ?>/single_comments.php?p=<?php the_ID(); ?>KeepThis=true&TB_iframe=true&height=600&width=400"><?php _e('Commentaire', 'clicclac'); ?></a>)
  3.             <?php } ?>

Ca marche bien, sauf que je n'arrive pas à avoir ma feuille CSS du thème dans la thickbox.

Dernière modification par ClicClac (04-07-2008 11:36:07)

Hors ligne

 

Pied de page des forums

Propulsé par PunBB 1.2.20
© Copyright 2005-2006 WordPress France