• I was wondering if there ways a way to hide the comments listing and link if comments are disabled for a post or page??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Yes, there is away to do that stuff. =) I have it done for my “new theme”, I’m working on for the main blog. I have it to show the following, for each.

    1) If comments are disabled for “articles”, it shows “comments off” text, no link, with it’s own image. And when or if someone clicks on that “Article’s” title link, it won’t show the comment form or anything. It just shows a “Heading” saying… “Comments Are Off”.

    2) If comments are on,but just don’t have any comments to the “article”, it shows, “Add Comment” text, with link. With the normal image for “comments”.

    And when or if someone clicks on that “Article’s” title link, it will show the comment form. It also shows a “Heading” saying… “Leave A Comment”.

    3) If comments are on, with some comments added to the “article”, it shows “6 Comments” text, with a link to able to make a comment. With the “normal” comments imagery.

    I also did some tweaking though, to the
    wp-includes/comment-functions.php file. So when someone clicks on the “Add Comment” link, it takes them right to the “Comment Form”.

    A good theme that helped me with this was the Regulus 2.
    http://www.binarymoon.co.uk/

    You’ll have to use some “IF” statements in the codes and such. And some other stuff, I’ll try and post some code in here then or a screen shot of what I have.

    Here is a couple screen shots.
    http://vindictivebastard.net/images2/comments-example.gif
    http://vindictivebastard.net/images2/comments-example-off.gif

    spencerp

    I might add some code then, but it’s just that it’s fit for my theme, not the “default” themes and such.. You’d have to modify your own comments.php file, which is, and can be, a pain in the arse..

    I decided to just post the url to a “Copy” of the comments.php file. Here is the url..

    http://www.vindictivebastard.net/comments2.php.txt

    Here is the codes I use in the theme’s index.php file, for that comment on and comment off stuff.

    <img src="<?php bloginfo('stylesheet_directory'); ?>/img/comments.gif" alt=""/>&nbsp;

    <?php if ( comments_open() ) {
    comments_popup_link( "Add Reply", "1 Reply", "% Replies", "Replies" ); } else { ?><img class="commoff" src="<?php bloginfo('stylesheet_directory'); ?>/img/comments-off.gif" alt=""/>Replies Off

    <?php } ?>

    And the CSS stuff for those images is:
    .comm, .commoff {
    margin: 0 0 0 -19px;
    background: url(img/comments.gif) no-repeat 0 0px;
    }
    .commoff {
    background: url(img/comment-off.gif);
    }

    You can always make up your own imagery for the comments.gif’s and such. I use that one on my blog now, I just made up another one same size for the comments-off.gif.

    I hope this helps.

    spencerp

    There is also some plugins over here that might work for you.. I just didn’t know about them right away sigh..
    http://codex.wordpress.org/Plugins/Comments

    Smart Comments I think is one..

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide somments info if turned off’ is closed to new replies.