Skip to main content

HIGHLIGHT ADMIN COMMENTS IN WORDPRESS

If you receive a lot of comments on your wordpress site and you need a quick way for users to find replies from you, the admin. Then this snippet is perfect for you!


Note: The image above is achieved with a bit more styling then in this snippet, but is easily achieved. This snippet simply styles the background color.

How it works is simple, you specify a user id to add a custom class to. It then checks the user id of the user commentating. If the id matches then it will add the custom class to that comment. In this case we will use user id 1. Which is the main account that created the wordpress website.

Read on to learn how…
STEP 1: EDITING THE COMMENTS.PHP FILE

In this step you need to open up comments.php from your theme folder. In this folder you need to find a line that looks like this:

<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">

Replace the above line with the following…

<li class="<?php
/* Only use the adminComment class from style.css if the user_id is 1 (admin) */
if (1 == $comment->user_id)
$oddcomment = "adminComment";
echo $oddcomment;
?>" id="comment-<?php comment_ID() ?>">

STEP 2: ADDING STYLE

Now open up your CSS stylesheet, usually style.css within your theme folder. Add the following to to it:

.adminComment {
background-color: #1e7c9a !important;
}

…and that is all, if you need a hand just comment and one of us will get back to you.

Comments

Popular posts from this blog

75 Surprisingly Creative Facebook Timeline Covers

Now that you have shifted to “Facebook Timeline” to display you profile in a better way, get creative with it. Facebook timeline gives you a chance to turn you profile exclusive and innovative. Putting up a personal picture as cover, will only make you look outdated. You can try some exciting covers to design your very own Facebook profile in distinguished style. We have scrounged through web to pick 75 amazing Facebook Timeline covers for this list. Unique cover pictures can give your timeline a different-from-the-rest look. You can create your own creative covers picking ideas from these cool pictures listed below. If you like this article, you might be interested in some of our other articles on  Facebook Scripts, Best Facebook Apps, Best Facebook Games, and Facebook Tips You Should Check . Ekkapong Techawongthaworn Be a brand ambassador and flaunt your fanaticism for gadgets and shopping on your cover. Ekkapong Techawongthaworn Gabriel Fort A snapshot of an App...

23 Best jQuery Slideshow (Gallery)

JQuery is becoming almost every programmer’s favorite. It gives you freedom of displaying images galleries in most effective way and that too with very little coding. When slideshows have become an integral part of the websites, the importance of jQuery cannot be ignored. Its easy usability has given it’s an edge over Flash. Do you remember the days when we used to see images grouped in tables (tr / td) and once clicked they opened in a new window or pop up! Those days are gone. Now we can use awesome jQuery plugins to showcase images in far more interesting ways. Slideshows provides great user experience. Checking and viewing image galleries have covered a long way in terms of development. Thanks to jQuery. Today we have come up with a power pack of Slideshows provides great user experience. Checking and viewing image galleries have covered a long way in terms of development. Thanks to jQuery. Today we have come up with a power pack of  Best jQuery Slideshow Plugins , which you wo...

GMAP3 – A jQuery Google Maps Plugin For The Developers

GMAP3  is one of the finest Google Maps jQuery Plugin which uses Google Map API version 3 to create maps with the advanced features available in it.  Google themselves has simplified the efforts in adding the maps in any website, but still applying some advance features are tricky sometimes. Unlike the other Google Maps plugin, GMAP3 aims to allows many manipulation of the google map API version 3. Let me take a look on the integration part. As I said, integration Google Maps with GMAP3 is simple and all you need is adding few things to get start with it Step 1:  Add the Google Maps script before closing  </head> <script type = "text/javascript" src = "http://maps.google.com/maps/api/js?sensor=false" ></script> Step 2:  Download the GMAP3 jQuery Plugin and upload it to your server <script type = "text/javascript" src = "gmap3.min.js" ></script> Now in order to embed the Google Maps, do the followi...