Forums

[resolved] "Comments Off" (19 posts)

  1. tmcgonegal
    Member
    Posted 4 years ago #

    Under each blog post, in addition to the words "Posted in xxxx", my blog displays "Comments Off".

    Since I have comments turned off for all posts by default, I'd kinda like to get rid of the "Comments Off" indicator. Can anyone suggest how I can do this?

    Thanks,

    Tom

  2. whooami
    Member
    Posted 4 years ago #

    go through your theme files, and locate all the occurances of :

    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>

    Removing that bit ought to remove all the stuff related to comment counting.

  3. tmcgonegal
    Member
    Posted 4 years ago #

    I'm not sure I worded my post correctly based on your reply.

    I'd like to remove the words "Comments Off" that appear under each post.

    Thanks,

    Tom

  4. whooami
    Member
    Posted 4 years ago #

    i understood your question. Did you understand my reply?

    What I pasted is responsible for what you are describing.

  5. tmcgonegal
    Member
    Posted 4 years ago #

    Thank you for the affirmation. No, I did not understand your reply. Now I do. I use the Default theme. I just checked, and under it are 2 folders and about 18 files. Do I need to check the files under the 2 folders (_vti_cnf & images) or just the 18 under the root defaults directory?

    When you say remove that "bit", I am not sure what you mean. Do you mean I should remove that whole string of characters you have specified?

    Thank you,

    Tom

  6. whooami
    Member
    Posted 4 years ago #

    (_vti_cnf & images) those arent theme files.

    All you need to pay attention to are the .php files.

  7. tmcgonegal
    Member
    Posted 4 years ago #

    When you say remove that "bit", I am not sure what you mean. Do you mean I should remove that whole string of characters you have specified?

    Thank you,

    Tom

  8. tmcgonegal
    Member
    Posted 4 years ago #

    There are 16 php files contained within the defaults theme folder. I copied and pasted the above character string you provided me into the Firefox FIND search box for each of the 16 files, after I opened each one in turn.

    I found no hits. Am I doing this correctly? I am using 2.3.3.

    Thanks,

    tom

  9. whooami
    Member
    Posted 4 years ago #

    3 files contain similar or identical code:

    search.php:

    <small><?php the_time('l, F jS, Y') ?></small>
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', ''); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    
    </div>

    index.php:

    </div>
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', ''); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    
    </div>

    archive.php:

    </div>
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', ''); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    
    </div>

    removing these exact bits will probably cause issues with the theme display, fwiw. I pasted more than what was necessary, just to make it easier for you to locate.

  10. tmcgonegal
    Member
    Posted 4 years ago #

    Thank you again. Can you tell I am a novice? :-)

    I am not anxious to cause an issue with my theme display, so may I be so bold as to ask a question? If you were to have instead posted only the what was necessary for me to delete, would that still cause issues with my theme display?

    Assuming an answer of "no", would you be so kind as to paste only what is necessary for me to delete?

    Based on your earlier post, I'm guessing it's just this part?

    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>

    Thank you,

    Tom

  11. whooami
    Member
    Posted 4 years ago #

    thats correct. and deleting just that bit *shouldn't* break the theme layout.

    *there is always room to be wrong.

  12. tmcgonegal
    Member
    Posted 4 years ago #

    Holy cow!! It worked!! You REALLY know this product, don't you? I neither know this product nor anything about PHP, but was able to follow your instructions and got the desired results.

    I learned from your tip and took it one step further. After applying your recommended changes, I was left with "Posted in Category-name |". By searching the same 3 files for Posted, I was able to delete the "|" character following "Posted in Category-name".

    Thank you very, very much.

    Tom

  13. intricateartist
    Member
    Posted 4 years ago #

    Can the "comments off" text be removed/altered without removing the call to the comments count/link?

  14. thejiggerypokery
    Member
    Posted 3 years ago #

    @intricateartist Yes

    <?php comments_popup_link('Leave a comment &raquo;', '1 Comment &raquo;', '% Comments &raquo;', '', 'comments off'); ?>

    Displays following:

    if no comments, displays --> Leave a comment »
    if 1 comment, displays --> 1 comment »
    if more than one comment (e.g. 5), displays --> 5 comments »
    css class --> not defined
    if comments are off, displays --> comments off

    So...put this in your template files and replace 'comments off' with whatever you want displayed (if nothing, leave blank but don't remove the single quotes)

  15. bramvanessen
    Member
    Posted 3 years ago #

    Hi thejiggerypokery,

    For some reason the code does not contain 'comments off', yet in the blog it appears when I don't allowe comments. The code looks like this:

    <?php
    // comments link
    comments_popup_link(
    __('No Comments', 'mandigo'). ' »',
    __('1 Comment', 'mandigo'). ' »',
    __('% Comments', 'mandigo'). ' »'
    );
    ?>

    What can I do to remove the text 'Comments off' from my blog?

  16. cellphonetrek
    Member
    Posted 3 years ago #

    Hi guys,
    I tried to follow the solution suggested for removing comments. I opened my archives, index and search and removed the bit as told above. Unfortunately upon doing so my site will not load. The admin panel still works, which leads me to believe something is amiss in the index. The site is http://www.cellphonetrek.com

    I loaded my backup files and still see a blank page at the root of my site.

    Any help would be appreciated, thanks!

  17. AMEEKER
    Member
    Posted 3 years ago #

    I would like to remove the "Comments are closed" text for posts/pages where comments are disabled, BUT leave the entire commenting section for posts where they're allowed.

    Can I do that with this snippet change? It seems like that would work just fine.

  18. bjheinley
    Member
    Posted 3 years ago #

    Here's the real question:

    Why isn't there a checkbox on the WP side of things that says "Comments Invisible' that would then render all comments invisible?

    Seems like a lot of work for WP folks to go through either the theme or the core files and have to edit/erase code that will ultimately be replaced in the next update.

    What a pain!

  19. llizard
    Member
    Posted 3 years ago #

    For people who have some posts that allow comments and some that do not, here's how to change "Comments Off":

    Line 720 of wp-includes/comment-template.php has the words 'Comments Off' as the value of the variable $none (in the comments_popup_link function)

    wordpress codex: FAQ working with wordpress

    To completely remove "comments off", open wp-icludes/comment-template.php in a text editor (notepad).

    look for:

    function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $css_class = '', $none = 'Comments Off' )

    Change it to:

    //change $none = 'Comments Off' to $none = ''
    function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $css_class = '', $none = '' )

    This will make it so that nothing at all appears on posts that have comments disabled. For posts that have comments enabled, the usual message can still appear.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.