• Resolved mqcarpenter

    (@mqcarpenter)


    I REALLY want to incorporate “comment bubbles” by my post listings on the sidebar and other post lists. I am referring to the exact feature shown in the admin panel here: Comment bubble in the admin panel. Has anyone seen a way to do this? I can not find a plugin or even a thread about it anywhere. Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • its just CSS applied to the span that contains the #.

    whats to pluginize? anything that displays comments can be done that way.

    Thread Starter mqcarpenter

    (@mqcarpenter)

    I am looking for the code to count the comments and display that element. I understand the design element of it in CSS. Looking at edit.php (which is the one that is in the screen shot) it appears that this may be it, but I am unsure:

    <?php
    
    if ( 1 == count($posts) && is_singular() ) :
    
    	$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
    	if ( $comments ) :
    		// Make sure comments, post, and post_author are cached
    		update_comment_cache($comments);
    		$post = get_post($id);
    		$authordata = get_userdata($post->post_author);
    	?>

    display comments for what? for posts?

    thats already done on your permalink pages. Look at how its done there

    what you pasted, btw,

    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");

    will work, as well, as long as you pass the post_id to $id

    Thread Starter mqcarpenter

    (@mqcarpenter)

    What I am looking for is the code that creates this output:

    <td class="num"><div class="post-com-count-wrapper">
    		<a href='edit-pages.php?page_id=6' title='0 pending' class='post-com-count'><span class='comment-count'>0</span></a>		</div></td>

    I need to be able to set it up outside the blog folder, like the post list is through this:

    <?
    $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts
    WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
    foreach($news as $np){
    printf ("<li><a href=\"%s\">%s</a></li>", get_permalink($np->ID),$np->post_title);
    } ?>
    Thread Starter mqcarpenter

    (@mqcarpenter)

    Wow I am amazed that no one else has ever wanted to do this. It seems so simple, yet it alludes me. Has anyone done this?

    I put a – (dash) in there just so you could see the separation.

    oops, I needed to close up a space and add the opening ul..

    ok, here we go, and its valid.

    <ul>
    <?php
    $news=$wpdb->get_results("SELECT ID, post_title, comment_count FROM $wpdb->posts
    WHERE post_type = 'post' AND post_status ='publish' ORDER BY post_date DESC LIMIT 10");
    foreach($news as $np){
    echo "<li><a href=\"" .get_permalink($np->ID)."\">$np->post_title</a>-<span class=\"bubble\">$np->comment_count</span></li>";
    }
    ?>
    </ul>
    Thread Starter mqcarpenter

    (@mqcarpenter)

    whooami, you just made my WEEK! Thank you so much!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Comment Bubbles Anyone?’ is closed to new replies.