WordPress.org

Ready to get started?Download WordPress

Forums

Show number of comments (5 posts)

  1. strikedamic
    Member
    Posted 6 years ago #

    Hi all
    You've probably read this questions 1000+ times, but I couldn't find an appopriate answer anywhere, so I'm posting it.
    I'd like to add the number of comments for a post in its title. Is there any "simple" code to add so that it shows "Comments: n" or "No comments"?
    Thank you.

  2. Dazzer
    Member
    Posted 6 years ago #

    use the template tag

    comments_number()

  3. strikedamic
    Member
    Posted 6 years ago #

    Ok, wow, thanks!
    Another question:
    I'd like to include the number of comments to the right side of the post title (see http://hot.sinister.ch for how this gotta look like). In Opera, it looks fine with <div class="right">, in IE, however, it's not being displayed in the right place. In both browsers, it's not completely aligned to the right.
    Please see the page and tell me what I have to do to fix this misplacement (in IE and Opera).

  4. Dazzer
    Member
    Posted 6 years ago #

    Bad CSS there.

    change your css stylesheet

    .title .right

    to

    .right

    If a class functions the same way no matter where it is, then don't give added complexity. Use Inheritance within .title to add additional properties.

    Currently, your element you're trying to float right is not within a .title element, and hence it does not float right.

  5. strikedamic
    Member
    Posted 6 years ago #

    I changed it all and ... well it didn't change anything.
    Could this be because I used a table for the title? (I did this to put the avatar, author name and etc information in the right place.

    <div class="title">
        <div class="left">
        <table CLASS="" BORDER="0">
    <tr>
    <td CLASS="" width="80" align="center" valign="top"><?php if(function_exists('cmd_show_avatar')){ cmd_show_avatar(); } ?></br><div class="details">
    
    <?php the_author_posts_link(); ?></div></td>
    <td CLASS="" align="left" valign="top"  width=150%>
    <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
        <div class="details"><font color=#ffffff><?php echo c2c_get_custom('subtitle'); ?></font><br><br><font color=#ffffff><?php the_category(', ') ?>&nbsp;||
    	<?php the_time('j. F y') ?><div class="right"><?php comments_number('No Comments', '1 Comment', '% Comments' ); ?></div></font><?php if (function_exists('has_rating')){ if(has_rating()){ get_rating(); } } ?></div>
        </div><br /></td>
    
       </tr></table></br>

    It's ugly code. But I need help :(

Topic Closed

This topic has been closed to new replies.

About this Topic