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

Posted

in

by

Tags:

Comments

16 responses to “And A WordPress Question”

  1. PolarBear Avatar

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

  2. Holly Avatar
    Holly

    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.

  3. teribella Avatar
    teribella

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

  4. Jason Penney Avatar

    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.

  5. Holly Avatar
    Holly

    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.

  6. Holly Avatar
    Holly

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

  7. Holly Avatar
    Holly

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

  8. teribella Avatar
    teribella

    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

  9. Jason Penney Avatar

    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','');
    }
    ?>

  10. Jason Penney Avatar

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

  11. Jason Penney Avatar

    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

  12. Holly Avatar
    Holly

    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.

  13. Jason Penney Avatar

    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 to Jason Penney Cancel 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.

16
0
Would love your thoughts, please comment.x
()
x