Forum Replies Created

Viewing 15 replies - 121 through 135 (of 169 total)
  • Thread Starter baal666

    (@baal666)

    Do you think we will soon have a clear guide on how to customize the comments page? It seems that I will need to modify the core WordPress files to do what I could do by simply modifying comments.php on WP 2.6

    Are we going backward with WP 2.7 or what?

    Thread Starter baal666

    (@baal666)

    Nice reply on your site, cdharrison! ?? Thanks

    Thread Starter baal666

    (@baal666)

    @cdharrison: Thanks a lot for the CSS example! But how would you integrate such CSS with the comments.php file?

    Thread Starter baal666

    (@baal666)

    Is it possible to do the same trick with 2.6? I mean, how to set odd, even and postauthor correctly?

    Thread Starter baal666

    (@baal666)

    I think I’ll stick to 2.6 for now. 2.7 is not ready. Too difficult to customize.

    What is the difference between the two codes above?

    I’m still having trouble with that.

    Thread Starter baal666

    (@baal666)

    Very interesting post you have there.

    If you have some free time, I wasn’t sure how to set things to work and I let a comment.

    Thread Starter baal666

    (@baal666)

    Thanks! I’ll read this carefully.

    Thread Starter baal666

    (@baal666)

    Thanks a lot Jeremy! You solved my problem!

    Just a last question while you’re here: how do I customize the comments now with 2.7? With 2.6 and below I would change manually everything in comments.php, but now it seems it is all inside the wp_list_comments() finction…

    I mean, I want to replace “Says” by something else, change some other things that can’t be done in CSS, etc.

    Thread Starter baal666

    (@baal666)

    Hmmm… anyway I will try to use the new 2.7 improvements. So far I can have the alternating comments. I just need to be able to make .bypostauthor work and I’ll be all right.

    @jeremyclark13: Is it me… or those two codes are the same?

    Thread Starter baal666

    (@baal666)

    I managed to get the original code and I did set the .mycomment class and was able to get comment style for my personal comments. However, I still can’t alternate colors even if the code says it should be possible:

    <?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 = 'odd';
    ?>
    
    <!-- You can start editing here. -->
    
    <div class="boxcomments">
    
    <?php if ($comments) : ?>
    
    <?php 
    
       /* Count the totals */
       $numPingBacks = 0;
       $numComments  = 0;
    
       /* Loop through comments to count these totals */
       foreach ($comments as $comment) {
          if (get_comment_type() != "comment") { $numPingBacks++; }
          else { $numComments++; }
       }
    
    ?>
    
    <?php 
    
       /* This is a loop for printing comments */
       if ($numComments != 0) : ?>
    
       <ol class="commentlist">
    
       <li class="commenthead"><h2 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h2></li>
    
       <?php foreach ($comments as $comment) : ?>
       <?php if (get_comment_type()=="comment") : ?>
    
    <li class="<?php if ( $comment->comment_author_email == get_the_author_email() ) echo 'mycomment'; else echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
    
          <p style="margin-bottom:5px;">By <strong><?php comment_author_link() ?></strong> on <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('M j, Y') ?></a> | <a href="#respond">Reply</a><?php edit_comment_link('Edit',' | ',''); ?></p>
          <?php if ($comment->comment_approved == '0') : ?>
          <em>Your comment is awaiting moderation.</em>
          <?php endif; ?>
          <?php comment_text() ?>
       </li>
    
       <?php /* Changes every other comment to a different class */
       if ('alt' == $oddcomment) $oddcomment = '';
       else $oddcomment = 'odd';
       ?>
    
       <?php endif; endforeach; ?>
    
       </ol>
    
       <?php endif; ?>
    
    <?php
    
       /* This is a loop for printing trackbacks if there are any */
       if ($numPingBacks != 0) : ?>
    
       <ol class="tblist">
    
    <li><h2><?php _e($numPingBacks); ?> Trackback(s)</h2></li>
    
    <?php foreach ($comments as $comment) : ?>
    <?php if (get_comment_type()!="comment") : ?>
    
       <li id="comment-<?php comment_ID() ?>">
          <?php comment_date('M j, Y') ?>: <?php comment_author_link() ?>
          <?php if ($comment->comment_approved == '0') : ?>
          <em>Your comment is awaiting moderation.</em>
          <?php endif; ?>
       </li>
    
       <?php if('odd'==$thiscomment) { $thiscomment = 'even'; } else { $thiscomment = 'odd'; } ?>
    
    <?php endif; endforeach; ?>
    
       </ol>
    
    <?php endif; ?>
    
    <?php else : 
    
       /* No comments at all means a simple message instead */
    ?>
    
    <?php endif; ?>
    
    <?php if (comments_open()) : ?>
    
       <?php if (get_option('comment_registration') && !$user_ID ) : ?>
          <p id="comments-blocked">You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=
          <?php the_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">
    
       <h3 id="respond">Post a Comment</h3>
    
       <?php if ($user_ID) : ?>
    
       <p>You are logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php">
          <?php echo $user_identity; ?></a>. To logout, <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">click here</a>.
       </p>
    
    <?php else : ?>   
    
          <p><label for="author">Name<?php if ($req) _e(' (required)'); ?></label>
          <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /></p>
    
          <p><label for="email">E-mail (will not be published)<?php if ($req) _e(' (required)'); ?></label>
          <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" size="22" /></p>      
    
          <p><label for="url">Website</label>
          <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /></p>
       <?php
    /****** Math Comment Spam Protection Plugin ******/
    if ( function_exists('math_comment_spam_protection') ) {
       $mcsp_info = math_comment_spam_protection();
    ?>    <p><input type="text" name="mcspvalue" id="mcspvalue" value="" size="22" tabindex="4" />
       <label for="mcspvalue"><small>Spam protection: Sum of <?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . ' ?' ?></small></label>
       <input type="hidden" name="mcspinfo" value="<?php echo $mcsp_info['result']; ?>" />
    </p>
    <?php } // if function_exists... ?>
       <?php endif; ?>
    
          <p><textarea name="comment" id="comment" cols="5" rows="10" tabindex="4"></textarea></p>
    
          <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
          <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 else : // Comments are closed ?>
       <p id="comments-closed">Sorry, comments for this entry are closed at this time.</p>
    <?php endif; ?></div>

    At the beginning of this code (sorry; I know it is long) it is written that odd is for alternating comments color. So I did set a class for .odd but the only thing it did was creating a color for each and every comments that is not mine.

    I see in the code further down that there is something about ‘even’, so I tried to set a .even but it didn’t work.

    Do you see something in the code that would show how to set the alternating comments?

    Anyone can help me? I can’t believe I’m the only person with this problem.

    Thread Starter baal666

    (@baal666)

    Hmmm… Now I tried this:

    <?php $i = 0; ?>
    <?php foreach ($comments as $comment) : ?>
         <?php $i++; ?>
    	<?php if (get_comment_type()=="comment") : ?>
    
    <?php if($i&1) {
            echo 'class="odd"';
        } else {
            echo 'class="even"';
        } ?>
    
    <li class="<?php if ( $comment->comment_author_email == get_the_author_email() ) echo 'mycomment'; else echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
    
    <li class="<?php if ($comment->user_id == 1) $oddcomment = "authorstyle"; echo $oddcomment; ?>">

    And I do see an alternating pattern, but I see class=”even” and class=odd written on the web page instead of the .even or .odd class applied.

    So weird.

    Thread Starter baal666

    (@baal666)

    For some reason not only does the alterning style does not work but the author style changes the background just over the author comment instead of modifying the author comment.

    Thread Starter baal666

    (@baal666)

    Hi,

    I tried to find some help on the same issue over the net, but wasn’t able to resolve the problem.

    What I want to do is pretty simple. In my wordpress comments.php file I want to have a different color for odd or even messages and have still another color for my personal comments.

    I tried nearly everything I could try on the net, toying with .odd and .even classes, but I think there is something really wrong with my code. If anyone could tell me what is wrong and how to make it work, I would greatly appreciate!

    Thanks

    <?$i;?>
    <?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;
    }
    }
    
    ?>
    <!-- You can start editing here. -->
    <!-- -->
    <!-- -->
    <!-- -->
    <?php if ($comments) : ?>
    
    <?php
    /* Count the totals */
    $numPingBacks = 0;
    $numComments = 0;
    /* Loop through comments to count these totals */
    foreach ($comments as $comment) {
    if (get_comment_type() != "comment") { $numPingBacks++; }
    else { $numComments++; }
    }
    ?>
    
    <?php
    /* This is a loop for printing comments */
    if ($numComments != 0) : ?>
    
    <ol class="commentlist">
    <li class="commenthead"><h2 id="comments" name="comment12"><?php comments_number('Aucun commentaire', 'Un commentaire', '% commentaires' );?> à la suite de ?
    <?php the_title (); ?> ?</h2>
    
    <?php foreach ($comments as $comment) : ?>
    
    <?php if (get_comment_type()=="comment") : ?>
    
    <?php $oddcomment = 'class="odd"'?>
    
    <li class="<?php if ( $comment->comment_author_email == get_the_author_email() ) echo 'mycomment'; else echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
    
    <li class="<?php if ($comment->user_id == 1) $oddcomment = "authorstyle"; echo $oddcomment; ?>">
    
    <div class="gravatarimg_ctnr"><img src="<?php gravatar("R", 50, "https://www.lelectronlibre.net/carnet3/uploads/default.jpg","FF0000"); ?>" alt="Gravatar" heigth="50" width="50" /></div>
    
    <p style="margin-bottom:10px;"><?php comment_author_link() ?> le " title=""><?php comment_date('j M Y') ?> | <?php if( function_exists( 'atrwcp_reply' ) ) atrwcp_reply(); ?><?php edit_comment_link('Edit',' | ',''); ?></p>
    
    <?php if ($comment->comment_approved == '0') : ?>
    Your comment is awaiting moderation.
    <?php endif; ?>
    
    <?php comment_text() ?>
    
    <?php endif; endforeach; ?>
    
    <?php endif; ?>
    
    <?php
    
    /* This is a loop for printing trackbacks if there are any */
    if ($numPingBacks != 0) : ?>
    # <h2><div align="center"><?php _e($numPingBacks); ?> Rétrolien(s)</div></h2>
    
    <!--<?php endif; ?>
    
    <?php else :
    
    /* No comments at all means a simple message instead */
    ?>
    
    <?php endif; ?> -->
    
    <?php if (comments_open()) : ?>
    
    <?php if (get_option('comment_registration') && !$user_ID ) : ?>
    <p id="comments-blocked">You must be /wp-login.php?redirect_to=
    <?php the_permalink(); ?>">logged in to post a comment.</p>
    <?php else : ?>
    
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
    <?php live_preview() ?>
    
    <div class="box1">
    
    <h3 id="respond">Commenter ce texte</h3>
    <div class="bordure-top"></div>
    
    <?php if ($user_ID) : ?>
    
    <p>Vous êtes connecté en tant que /wp-admin/profile.php">
    <?php echo $user_identity; ?>.
    /wp-login.php?action=logout" title="Se déconnecter">Se déconnecter.
    </p>
    
    <?php else : ?>
    
    <p><label for="author">Nom<?php if ($req) _e(' (*)'); ?></label>
    <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /></p>
    
    <p><label for="email">Courriel<?php if ($req) _e(' (*)'); ?></label>
    <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" size="22" /></p>
    
    <p><label for="url">Site internet</label>
    <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /></p>
    
    <?php endif; ?>
    Commentaire:
    <p><textarea name="comment" id="comment" cols="4" rows="7" tabindex="4"></textarea></p>
    
    <p><input name="submit" type="submit" id="submit" class="input1" value="Envoyer" />
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> </p>
    </form>
    <div class="box2"><?php do_action('comment_form', $post->ID); ?></div>
    </div>
    
    <?php endif; // If registration required and not logged in ?>
    
    <?php else : // Comments are closed ?>
    <p id="comments-closed">Sorry, comments for this entry are closed at this time.</p>
    <?php endif; ?>
    Thread Starter baal666

    (@baal666)

    YOU are a genius! Thanks ??

    Thread Starter baal666

    (@baal666)

    Another strategy would simply be to be able to change the “uhec.net” part to “lelectronlibre.net” in each and every link on my blog… How can I do that?

Viewing 15 replies - 121 through 135 (of 169 total)