WordPress.org

Ready to get started?Download WordPress

Forums

Can I hide "comments off" tag? (19 posts)

  1. Aga1
    Member
    Posted 4 years ago #

    I have several pages on my site that don't require comments: I'd like to hide the "Comments Off" tag at the bottom of the post. Is there a plug-in that does this, or can it be done some other way?

    Many thanks for any tips.

  2. rcktech
    Member
    Posted 4 years ago #

    Hi Aga1

    You just beat me by 17 minutes, I have the same questions posted, You must have posted the question while I am still typing mine. I’ll have to watch both our messages.

  3. Aga1
    Member
    Posted 4 years ago #

    I'm doing a charity website, and some pages don't need comments at all, such as a "Thank you for your donation" page, for example. Having "Comments Off" at the bottom of the page just looks ugly, as well as being pointless, and I'd like to remove it. However, there are also some pages where comments are welcome.

    All of the advice I've seen so far seems to be how to remove these words on ALL pages, not on selected ones. Is it simply a case of 'all on/all off' or is there any way of being selective?

  4. magdelaine
    Member
    Posted 4 years ago #

    I would like to know how to do this too. I tried editing out snippets of code and I still couldn't get rid of it. My next step is to design a page template with no comment code at all and see if that works; but I would like to know if there is another answer before I go to the trouble.

  5. magdelaine
    Member
    Posted 4 years ago #

    Ok, I found the answer. It's here: http://codex.wordpress.org/FAQ_Layout_and_Design#How_do_I_get_rid_of_the_.22No_Comments.22_message_displayed_with_every_post.3F.
    . Also, I found this post helpful: http://wordpress.org/support/topic/221245?replies=5. I think that since I want comments on posts but not on pages I will just create a new page template with the referenced code removed.

  6. Aga1
    Member
    Posted 4 years ago #

    No, this is still not it. This removes the tag from ALL pages, not selected ones.
    Come on... SOMEONE must know how to do this?

  7. Aga1
    Member
    Posted 4 years ago #

    I can't believe no-one here has the answer to this.... anyone? Please?

  8. Aga1
    Member
    Posted 4 years ago #

    All of the advice I've seen so far seems to be how to remove these words on ALL pages, not on selected ones. Is it simply a case of 'all on/all off' or is there any way of being selective?

  9. Aga1
    Member
    Posted 4 years ago #

    I keep askin' but no-one's answerin'.... does that mean that you ALL don't know? I can't believe it.... can I hide the "comments off" on those pages that don't require comments, and leave comments running normally on others?

  10. gkemp
    Member
    Posted 4 years ago #

    I would like to be able to selectively turn off the comments and comment form for certain pages also. Does anyone know of a plugin that adds this capability page by page?

  11. jonrichards_net
    Member
    Posted 4 years ago #

    Here's what I did to accomplish this.

    In my comments.php file, I removed the line
    <p class="nocomments">Comments are closed.</p>.

    Then, in my index.php file, find this line
    comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'))
    and change it to this

    if ( comments_open() ) {
        comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'));
    } ?>

    Then on any page you turn off comments for, you won't see "Comments are off" or "Comments are closed".

  12. phunkateer
    Member
    Posted 4 years ago #

    i dont have

    comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'))

    that line of code so i'm not sure where to put your replacement, jonrichards.

    i've gone as far as to use the plugin> "no comments on pages". seems like it'd be insanely useful, but it didn't work for me. try it out for yourself. i'm pretty sure it disables all comments ANd that annoying 'no comment' txt. for some reason, no matter what i do i sitll can't get it gone.

    i DID manage to get rid of the comment txt thing though, in page.php, possibly a custom thing for the theme i'm in.

  13. Dr Madvibe
    Member
    Posted 4 years ago #

    There's a bit of php code within a div on the main index template (in my theme anyway) that you should be ale to change.

    Swap this
    <div class="commentlink"><?php comments_popup_link(some lovely php code); ?></div>

    for this
    <div class="commentlink"><?php if ( comments_open() ) {
    comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'));
    } ?></div>

    However, do take a copy before you play with it in case it doesn't work. It worked in my theme, it may not in yours.

  14. elfhands
    Member
    Posted 4 years ago #

    I have this problem online when I see my WP Page on the Internet, but on xampplite "Comments Off" is not present. (All things being apparently equal.)

  15. Fitness4you.ca
    Member
    Posted 4 years ago #

    Hey,

    I figured out how to turn off the "comments off" on the home page and on the rest of the pages but how do i turn it off for all of my posts?

  16. Finchy
    Member
    Posted 4 years ago #

    I wanted comments removed from my pages, but not posts. My theme had the line in the Page template (page.php) which I hid like this:

    <!--<?php comments_template(); ?>-->

    I would not delete anything from any template but just use <!-- --> to hide the code.

  17. alchymyth
    Forum Moderator
    Posted 4 years ago #

    @Finchy
    the way you comment the line (html comments), the php will still execute and the results will be shown in the html code in your browser, although not visible to the viewer (adding to loading time).

    if you want to comment php functions, you can for instance use:
    method 1
    <?php // comments_template(); ?>
    double slash characters // - to comment the rest of the line after the //
    method 2

    <?php /* comments_template();
    more code;
    another bit of code;
    function(); */ ?>

    /* */ - to coment everything between the start /* and the end */

    using these methods stops the execution of the code already in the server, so nothing will appear in the browser

  18. msolution
    Member
    Posted 4 years ago #

    i ran into the same issue, but i wanted to hide it in some pages only, not all, this is what i did - http://www.dir.vc/forum/index.php?topic=645.0

    hope it helps.

    M.

  19. underclass
    Member
    Posted 4 years ago #

    To hide the comments field I used a conditional statement so the comments output was hidden on my frontpage and displayed on all other pages;

    <?php if (!is_front_page()) comments_template('', true); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.