And A WordPress Question

Anyone know of a way to keep the “No Comments” link from showing for posts where comments are disabled? If there’s a way to put that in the template, it would save people from clicking through to comment where they can’t.

image_pdfDownload as PDFimage_printPrint Page

About the author: Novelist, writing teacher, on a mission to reprint my out-of-print books and self-publish my new ones.

15 comments… add one
  • PolarBear Jul 28, 2005 @ 9:33

    Moderation is a wonderful thing. So far, it’s caught all the spam that’s been tossed to it.

  • hollylisle Jul 28, 2005 @ 1:16

    Jason — Yes, it was stuck in moderation. I’m not used to moderation yet. I have this thing set to e-mail me about moderation, but it doesn’t seem to be. Yet. I’ll get it worked out. Thank you again for the code. I love it.

  • teribella Jul 27, 2005 @ 16:59

    Thanks so much for the code! Gonna go play with it now…
    Bella

  • Jason Penney Jul 27, 2005 @ 15:23

    You know, the comment shows up when I’m logged in, and doesn’t when I’m not.

    Is it possible stuck in a moderation queue? I know you don’t like to log into the site, but you might have to to approve the comments with the link (and then you can delete the bad ones).

    I probably posted in rapid succession so it thinks I’m a bot.

  • Jason Penney Jul 27, 2005 @ 15:13
  • hollylisle Jul 27, 2005 @ 14:42

    Here’s the code I used for previous/next posts and previous/next-in category posts:

    <h4>Previous/Next Posts</h4>
    <
    p><center><em><?php previous_post(‘&laquo; %’, ”, ‘yes’);
    ?>
    | <?php next_post(‘% &raquo; ‘, ”, ‘yes’); ?></em></center></p>
    <h4>Previous/Next Posts In Same Category</h4>
    <
    p><center><em><?php previous_post(‘&laquo; %’, ”, ‘yes’,
    ‘in_same_cat’, ‘yes’); ?>
    | <?php next_post(‘% &raquo; ‘, ”, ‘yes’, ‘in_same_cat’, ‘yes’); ?></em></center></p>

    These work for WP 1.5.1.3 — not sure how far back they’ll still be valid.

  • hollylisle Jul 27, 2005 @ 14:38

    Though the final link with working code seems to have disappeared. Jason,can you repost?

  • hollylisle Jul 27, 2005 @ 14:37

    Jason — Thank you! That code is awesome. Works perfectly.

  • teribella Jul 27, 2005 @ 14:29

    Love the new site set-up… looks great from here! I’ve been using WP for 6+ months now, and I’ve yet been able to figure out how to get the “next/previous entries” to show up on the bottom of the screen… can you tell me what you tweaked to get that to work? Thanks! Bella

  • Jason Penney Jul 27, 2005 @ 13:47

    Erg!

    The code is here:
    http://www.jczorkmid.net/~jpenney/comments_popup_link.txt

    Sorry for all the bad posts.

  • Jason Penney Jul 27, 2005 @ 13:43

    whoops! missed something there (sorry, delete the other comment if you can):


    get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
    }
    $number = $comment_count_cache[$id];
    if (($number != 0) && !('closed' == $post->comment_status)) {
    comments_popup_link('No Comments', '1 Comment', '% Comments','comments-link','');
    }
    ?>

  • Jason Penney Jul 27, 2005 @ 13:26

    Of course I meant, “That last empty string argument is what to display when you have comments disabled.”

  • Jason Penney Jul 27, 2005 @ 13:24

    This will get you a little closer to what you want. In your template find the call to comments_popup_link(). It probably looks like this:
    comments_popup_link(‘No comments’, ‘1 Comment’, ‘% Comments’);

    Change it to this:
    comments_popup_link(‘No comments’, ‘1 Comment’, ‘% Comments’,’comments-link’,”);

    That last empty string argument is what to display when you have no comments.

    That still doesn’t get you the trackback support you want.

    Jay

  • hollylisle Jul 27, 2005 @ 13:15

    Unchecking “Allow Pings” blanks the link. That’s a good start. What I want is to have it work sort of the way it worked on Geeklog, of course, where if comments weren’t allowed, no link appeared at all — very clean looking. And with nothing showing if trackbacks are allowed, but none exist. But if pings are allowed, and comments aren’t allowed, and one or more trackbacks exist, that the link will then appear. Kind of a conditional if-then statement. If I knew php, I’d be golden right about now.

  • Jason Penney Jul 27, 2005 @ 12:47

    Have you tried unchecking “Allow comments” and “Allow pings”?

    If pings are enabled, they show up as comments. I believe the link is left enabled in case you get any TrackBacks if you just uncheck “Allow comments”.

    Jay

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Next post:

Previous post: