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.
And A WordPress Question
by
Tags:
Comments
16 responses to “And A WordPress Question”
-
Moderation is a wonderful thing. So far, it’s caught all the spam that’s been tossed to it.
-
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.
-
Thanks so much for the code! Gonna go play with it now…
Bella -
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.
-
Sure, here it is:
http://www.jczorkmid.net/~jpenney/comments_popup_link.txt -
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(‘« %’, ”, ‘yes’);
?>
| <?php next_post(‘% » ‘, ”, ‘yes’); ?></em></center></p>
<h4>Previous/Next Posts In Same Category</h4>
<
p><center><em><?php previous_post(‘« %’, ”, ‘yes’,
‘in_same_cat’, ‘yes’); ?>
| <?php next_post(‘% » ‘, ”, ‘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.
-
Though the final link with working code seems to have disappeared. Jason,can you repost?
-
Jason — Thank you! That code is awesome. Works perfectly.
-
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
-
Erg!
The code is here:
http://www.jczorkmid.net/~jpenney/comments_popup_link.txtSorry for all the bad posts.
-
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','');
}
?>
-
Of course I meant, “That last empty string argument is what to display when you have comments disabled.”
-
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
-
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.
-
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