Home › Support › Popular Widget › Showing post title in Most Commented list › Reply To: Showing post title in Most Commented list
March 27, 2012 at 10:30 am
#45699
coeurmechante
Participant
Hi again,
I figured it out myself.
After line 88 on my code: foreach($comments as $comment){
I added (sorry if it’s not pretty… I don’t see a way to add code):
$post_titles = $wpdb->get_results(“SELECT * from $wpdb->posts WHERE ID=’$comment->comment_post_ID'”);
foreach ($post_titles as $post_title){
$the_post_title = ($post_title->post_title);
$the_post_id = ($post_title->ID);
}
Then I can call $the_post_title and $the_permalink($the_post_id) where needed. There may be a more elegant solution, but this works for me!