A while ago, I asked on the support forum for Graphene if it would be possible to include the permalink for each comment. That will be an option with the next version (1.7) of the theme (thanks, Syahir!), but it’s possible to do that even before then. In fact, thanks to the wide number of comment functions WordPress has available, you can add a number of informative, if not entirely useful, bits of information to your comments.
To get started, you’re going to need to know how to use Graphene’s action hook widget areas. If you haven’t done so already, go ahead and read my tutorial.
Next, install the PHP widget. You’re going to need that.
Now, go to Graphene Options >> Advanced Options >> Action Hook Widget Areas. Click on “includes/theme-comments.php” and then tick the box marked ““. Click the “Save Options” button at the bottom, and then navigate to your Widgets pane. You will now see a widget area titled “Graphene Comment Meta”. Drag a PHP widget to that widget area.
This is where the fun begins.
The WordPress function for the comment’s permalink is `comment_ID()`. You can simply enter that in the PHP widget and call it a day. Or, you can add a bit of HTML and a few other functions to spice up your comments. Here’s what’s in my comment meta:
<span style="color: #6B6B6B; font-size:11px;"> Posted from <a href="http://<?php comment_author_IP(); ?>" target="blank"> <?php comment_author_IP(); ?> </a> | <a href="#comment-<?php comment_ID() ?>">Permalink</a> | <?php post_comments_feed_link( $link_text = 'Comment feed for this post.' ) ?> </span>
You’ll notice that I wrapped the entire thing in a `<span>` so that I could style it. I also added the comment author’s IP address, as well as the RSS feed for the comments on that post (for the day when I have enough comments to make it worthwhile to pay attention to such things).
If you want other ideas about how to use these various WordPress functions, then read this page on the WordPress Codex which explains the `comment_ID()` function. At the bottom, under “Related” you will find a number of other comment meta functions you can have fun with.
https://techblog.kjodle.net/2012/03/23/add-comment-metadata-to-the-graphene-theme-for-wordpress/
I’m going to add a comment here so you will know what this look likes. Don’t stay up all night having fun with this.
I was using the same method in one of my client’s Graphene site. But, with
<a href="#comment-">Link to this comment
It is not good to disclose commenter’s IP address. Not everyone likes it, including me! 😉
Link is missing to the comment_ID() function in the WordPress Codex. Updating the post with link would be helpful.
Thanks Ken!
Yes, I included the IP address just to show what is possible. But you’re right: many don’t like it and it does nothing to discourage spammers.
Oops! I’ve fixed that now.
hi,
I have a question regarding article posts. I have a Blog where the Users can write Articles. Just like a normal Blog. But I don´t see which time they wrote the article, I see just the date.
It is possible to add the creation time next to author e.g. from admin 10:50
best regards
You’ll need to use the comment date function (
< ?php comment_date( 'd', $comment_ID ); ?>
) and then adjust the settings to show the time.This page will show you how to use that function, and this page will show you how to format the date and time.
I’ve answered this question here…
What you named this, as a plugin or nothing.
It’s not a plugin. This method takes advantage of Graphene’s built-in action hook widget area functionality.
Had a little trouble getting this to work right at first but I found the error and everything is looking great! thanks for the code! 🙂