Thread Starter
Anonymous
Oh I forgot to tell you what to do with the above code, simply insert this wherever you want the data to show up, and BAM! There it is.
I am using thi son my site now, http://www.chrisjdavis.org/ it listed under, get this; recently commented!
Later
Great feature. Can you explain what character “\” stands for or should that literally be put into the code? Put into my page this way just displays the title of my post with an /n after it and no hyperlinking.
It’s a slash. \ I had to post it to my blog to figure it out. LOL
Argh… a forward slash that is. π
I can’t seem to get it to work though. I am assuming the code isn’t being displayed properly here. I viewed the source and copied but still no luck.
replace the echo line with this
echo "$data[2]
$data[1]<br
/>
";
Thread Starter
Anonymous
Is there a WordPress 1.01 version of this hack?
*crosses fingers*
function recent_comments($limit = 5) {
global $wpdb, $tableposts, $tablecomments, $siteurl, $blogfilename;
$out = '';
$sql = "SELECT ID, post_title, comment_ID, comment_author, comment_date, comment_content FROM $tableposts, $tablecomments";
$sql .= " WHERE $tableposts.ID=$tablecomments.comment_post_ID";
$sql .= " ORDER BY $tablecomments.comment_date DESC LIMIT $limit";
$posts = $wpdb->get_results($sql);
foreach ($posts as $post) {
$permalink = $siteurl.'/'.$blogfilename.'/?p='.$post->ID.'&c=1#comment-'.$post->comment_ID;
$comment = substr(stripslashes($post->comment_content), 0, 50);
$out .= '
PLEASE post code to the wiki and LINK TO IT from here. Thank you.
Thread Starter
Anonymous
I would use this function for the creation of a url:
get_permalink($recentcomment->post_id)
Can you put that in the script?
This hack is now officially dead, go here: http://www.chrisjdavis.org/index?p=439 for the last release.
Author_list is dead as well, as is the copyright hack, at least as far as releasing them to the general public.
You will still be able to find the code @http://www/chrisjdavis.org but I won’t be releasing them here anymore. I might announce when something has reached a decent level of maturity, but that is about it.
This is the right code
<li id="last_comments">
<?php _e('Last Comments:'); ?>
<ul>
<?php
$query = "SELECT ID, comment_post_ID, comment_author, comment_content FROM $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID ORDER BY $tablecomments.comment_date DESC LIMIT 5";
$result = mysql_query($query);
while ($data = mysql_fetch_row($result)) {
if (!$data[2]) {
$data[2]="Anonymous";
}
echo "<li>";
echo "[$data[2]] <a href="index.php?p=$data[1]#comments">";
echo substr($data[3],'0','80');
echo "...</a></li>";
} ?>
</ul>
</li>