WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Comments Link on index page - can it be geyed when (3 posts)

  1. Anonymous
    Unregistered
    Posted 10 years ago #

    Hi,
    Is there a way to have the comments greyed out when a post has the comments switched off?
    At the moment when I switch comments off it still lets you click the comments link.
    Thanks
    Karl

  2. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    You have to turn off both comments and pings.

  3. davidchait
    Member
    Posted 10 years ago #

    I've posted a snippet of script(s) at http://www.chait.net/wp-mods/comment-tags.php. It contains a new function, plus the topmost (in the file..) following comments_ tag functions from template-functions.php. At some point, I'll start posting these things as actual posts on the site. ;)
    Note that I didn't want to put up my entire template-functions, as I have other extensive modifications, and they wouldn't work on vanilla WP sites.
    These encapsulated changes should work with relatively recent (1.0ish) versions... though my usual CAVEAT: I'm not always running a match set of code to any particular WP release, and thus some of the code may not work without a little tweaking.
    What does my modification do:
    1. new tag get_comments_number returns the integer count of comments for the current post.
    2. adds caching, so that the comment count isn't looked up multiple times for a single post.
    3. comments_number now returns the raw string, not a link.
    4. comments_popup_link in this version actually returns a BLANK string for a 'closed' post with 0 comments, the 'no comments' string if 0 comments on an open post (but NOT as link, just a string), and the 'normal' comments link if 1 or more comments for the post. To put it another way, closed posts with no comments show no link or text, open posts with no comments just show the no comments text, and all other cases work as WP release used to.
    =d

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.