| View previous topic :: View next topic |
| Author |
Message |
blacklighter
Joined: 27 Mar 2005 Posts: 16
|
Posted: Mon Mar 28, 2005 3:48 pm Post subject: Highlight Comments by Author |
|
|
i've notice that your blog wont differentiate comments made by the blog owner itself. i've tried to search for this feature over the forum but no one seems to post it before.
i found this at the wordpress support forum. do you think we can adapt it into our smarty tags to make it differentiate our comments? anyone experienced or the admin please provide the necessary instructions.
$authorcomment = '';
if($comment->comment_author_email == get_the_author_email()) {
$authorcomment = ' authorcomment';
}
thanks |
|
| Back to top |
|
schinckel
Joined: 03 Apr 2005 Posts: 1238 Location: Adelaide, Australia
|
Posted: Sat Aug 13, 2005 5:31 am Post subject: |
|
|
I did this just the other day.
I had to use Smarty Tags {capture} method:
| Code: | {if $comments != ''}
{capture name=author}{the_author_email}{/capture}
<ol class="commentlist">
{foreach from=$comments key=key item=comment}
{globalvar var='comment' value=$comment}
{capture name=reader}{comment_author_email}{/capture}
{if $smarty.capture.reader == $smarty.capture.author}
<li class="owner" id="comment-{comment_ID}">
{else}
<li class="alt" id="comment-{comment_ID}">
{/if}
On <a href="#comment-{comment_ID}">{comment_date} at {comment_time}</a>, {comment_author_link} said:
|
The first line (after the {if}, that's just there for context!) gets the value of {the_author_email}, and stores it in the smary variable $smarty.capture.author
(You need to do this to stop it being sent to the client, a Spam risk).
The next capture line does the same for the email of the commenter. There is then a comparison of the two, and if they are the same, set the class of the comment list item to "owner", else set the class to "alt".
You will also need to modify your StyleSheet, so that the comments look a different colour. In mine, this required:
| Code: |
.commentlist li.owner
{
background:#F5EFEB url('/images/comments_bottom2.jpg') repeat-x bottom;
} |
Visit http://schinckel.blogsome.com/2005/08/10/blogsome-gravatar-code/ to see this in practice. _________________ Blogsome Forum: Rules/Search
WordPress Codex; Smarty Tags Docs |
|
| Back to top |
|
spoutnik
Joined: 02 Feb 2005 Posts: 54 Location: Belgique - Bruxelles
|
Posted: Sat Aug 13, 2005 1:55 pm Post subject: |
|
|
I have tried to implement the code above on my own blog but a can't reach the same effect. I have made the changes in my css but nothing happen : the background color is still blue on all the comments..
I am using the theme "ShadedGrey" don't know if this is important.
Anyone with an idea of what i am missing?
Thanks in advance. _________________ Le molenbeekois perdu dans la grisaille bruxelloise est heureux de se joindre à vous.
http://melain.blogsome.com |
|
| Back to top |
|
schinckel
Joined: 03 Apr 2005 Posts: 1238 Location: Adelaide, Australia
|
|
| Back to top |
|
spoutnik
Joined: 02 Feb 2005 Posts: 54 Location: Belgique - Bruxelles
|
Posted: Sun Aug 14, 2005 6:54 pm Post subject: |
|
|
Hello from Brussels,
Once again you were right Matt. It was simply a colour problem (as you wrote they were so subtley different.
Thanks for pointing this issue didn't know that..
Everything is ok now _________________ Le molenbeekois perdu dans la grisaille bruxelloise est heureux de se joindre à vous.
http://melain.blogsome.com |
|
| Back to top |
|
Lurker
Joined: 18 Aug 2005 Posts: 17
|
Posted: Thu Aug 18, 2005 1:04 pm Post subject: |
|
|
Hey guys,
My site (footy.blogsome.com) doesn't have the comments in any boxed out color. They are just plain text one after another. I think it needs some color for each comment.
How can I do this for my site? |
|
| Back to top |
|
schinckel
Joined: 03 Apr 2005 Posts: 1238 Location: Adelaide, Australia
|
Posted: Fri Aug 19, 2005 12:20 am Post subject: |
|
|
You'll need to edit your stylesheet, and add/edit the tags for comments. Exactly what tags will be used will depend on your template, but mine are:
| Code: | #commentarea
{
margin:0 0 40 0;
}
.commentlist {
font-size:1em;
font-weight:normal;
}
#comments,#respond {
text-transform: uppercase;
margin: 3em 0 1em 40px;
color: #676E04;
font: 0.9em verdana, helvetica, sans-serif;
}
.commentlist li
{
margin:5px 0;
padding:10px 10px 20px 10px;
background:#F3F6ED url('/images/comments_bottom.jpg') repeat-x bottom;
border:#E1D6C6 1px solid;
}
.commentlist .alt
{
}
.commentlist li.owner
{
background:#F5EFEB url('/images/comments_bottom2.jpg') repeat-x bottom;
} |
If you look in your comments.html template, you will be able to see what the ids of the various divs are, and then figure it out.
If the worst comes to the worst, and you can't, post your comments.html here and we'll try and help out. _________________ Blogsome Forum: Rules/Search
WordPress Codex; Smarty Tags Docs |
|
| Back to top |
|
Lurker
Joined: 18 Aug 2005 Posts: 17
|
Posted: Fri Aug 19, 2005 9:49 am Post subject: |
|
|
Well, the only code relating to anyting "comment" in the stylesheet is as follows:
| Code: | }
#comment {
height: 150px;
width: 400px;
} |
As for my comments.html - this is it-
| Code: | <h2 id="comments">{comments_number zero="Comments" one="1 Comment" more="% Comments"}
{if $post->comment_status == 'open'}
<a href="#postcomment" title="{_e text="Leave a comment";}">»</a>
{/if}
</h2>
{if $post->ping_status}
{/if}
{if $comments != ''}
<ol id="commentlist">
{foreach from=$comments key=key item=comment}
{globalvar var='comment' value=$comment}
<li id="comment-{comment_ID}">
{comment_text}
<p><cite>{comment_type} {_e text="by"} {comment_author_link} — {comment_date} @ <a href="#comment-{comment_ID}">{comment_time}</a></cite> {edit_comment_link link='Edit This' before=' |'}</p>
</li>
{/foreach}
</ol>
{else} <!-- this is displayed if there are no comments so far -->
<p>{_e text="No comments yet."}</p>
{/if}
<h2 id="postcomment">{_e text="Leave a comment"}</h2>
{if 'open' == $post->comment_status}
<form action="{$siteurl}/wp-comments-post.php" method="post" id="commentform">
<p>
<input type="text" name="author" id="author" class="textarea" value="{insert name=var var=comment_author}" size="28" tabindex="1" />
<label for="author">{_e text="Name"}</label> {if $req != ''} {_e text='(required)'} {/if}
<input type="hidden" name="comment_post_ID" value="{$post->ID}" />
<input type="hidden" name="redirect_to" value="{$redirect_to}" />
</p>
<p>
<input type="text" name="email" id="email" value="{insert name=var var=comment_author_email}" size="28" tabindex="2" />
<label for="email">{_e text="E-mail"}</label> {if $req != ''} {_e text='(required)'}{/if}
</p>
<p>
<label for="comment">{_e text="Your Comment"}</label>
<br />
<textarea name="comment" id="comment" cols="60" rows="4" tabindex="4"></textarea>
</p>
<p>
<input name="submit" type="submit" tabindex="5" value="{_e text="Say It!"}" />
</p>
</form>
{else} <!-- comments are closed -->
<p>{_e text="Sorry, the comment form is closed at this time."}</p>
{/if}
<p> |
So, hmm, what do I do? |
|
| Back to top |
|
schinckel
Joined: 03 Apr 2005 Posts: 1238 Location: Adelaide, Australia
|
Posted: Fri Aug 19, 2005 10:24 am Post subject: |
|
|
Okay, the first bit should be pretty easy.
1. Place the line:
| Code: | | {capture name=author}{the_author_email}{/capture} |
just after the line:
{if $comments != ''}
2. Replace the line:
| Code: | | <li id="comment-{comment_ID}"> |
with the block:
| Code: | {capture name=reader}{comment_author_email}{/capture}
{if $smarty.capture.reader == $smarty.capture.author}
<li class="owner" id="comment-{comment_ID}">
{else}
<li class="alt" id="comment-{comment_ID}">
{/if} |
Now, Save the file. Refreshing a page will tell you if I got the edits right! It should load without any changes.
Now add the desired information to the stylesheet; basically it's just the commentlist ones, and you'll need to edit them to how your blog want them to be. _________________ Blogsome Forum: Rules/Search
WordPress Codex; Smarty Tags Docs |
|
| Back to top |
|
Guest
|
Posted: Fri Aug 19, 2005 12:43 pm Post subject: |
|
|
Ok,
I did ask you said. However, the code I am adding on the commentlist in the style sheet just isn't working for me. I don't get any changes.
I have played around with it for a bit, but I just don't see any results. Making it even harder for me on how I should edit, since I can't judge the changes.
Basically This is how it looks at the moment
And this is how I want to make it. (I used paint shop pro for this.)
 |
|
| Back to top |
|
schinckel
Joined: 03 Apr 2005 Posts: 1238 Location: Adelaide, Australia
|
Posted: Sat Aug 20, 2005 1:54 am Post subject: |
|
|
Okay, I'm going to have a quick crack at it now.
To make issues like this easier, you should use Firefox, and the EditCSS extension. This means you can update CSS on the fly, and see how it looks. _________________ Blogsome Forum: Rules/Search
WordPress Codex; Smarty Tags Docs |
|
| Back to top |
|
schinckel
Joined: 03 Apr 2005 Posts: 1238 Location: Adelaide, Australia
|
|
| Back to top |
|
Lurker
Joined: 18 Aug 2005 Posts: 17
|
Posted: Sat Aug 20, 2005 12:43 pm Post subject: |
|
|
Thanks Schinckel,
You DA MAN!
Funny how it was just one little thing that was holding me back. Now I changed the colors has I want them and they work perfect. |
|
| Back to top |
|
schinckel
Joined: 03 Apr 2005 Posts: 1238 Location: Adelaide, Australia
|
|
| Back to top |
|
siqa
Joined: 26 Aug 2005 Posts: 19
|
Posted: Wed Mar 01, 2006 8:39 am Post subject: |
|
|
| schinckel wrote: | Bingo!
Try using #commentlist instead of .commentlist (in each case). |
what u mean by using #commentlist instead of .commentlist (in each case)..
i put that code but it doesn't work |
|
| Back to top |
|
|