Forums

How to delete entire comments section? (9 posts)

  1. lcnewbie
    Member
    Posted 6 years ago #

    Hi, I am designing a website in WP for info / business use only and do not want the comments section to show on any of the pages at all. I have 'turned off' the possibility of users posting comments but is there anyway of getting rid of this completely so 'Sorry comments section is currently closed etc' does not appear. Hope this makes sense.

    I know its not what WP was designed for but I do really like using it now I've got the hang of it a bit.

    Any suggestions gratefully recieved

    Thanks alot

  2. Chris_K
    Member
    Posted 6 years ago #

    More theme editing to do. If you truly are never going to offer comments, then just remove the comment tags from your theme files.

    Be sure to back up files (make a local copy even) before starting!

    For example, using the Default theme, look at index.php.
    Find <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> and delete it.

    As another example, same theme, look at Single.php. There's a block of code that starts with
    <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status))
    and finishes with
    <?php }

    Maybe instead of deleting all that, you might just want to tweak the wording a bit. Or, if you don't care about pingbacks and trackbacks, you can rip it all out.

    Hope that gives you enough to start with. Without knowing your theme and how it organizes thing, this is all conjecture. :-)

  3. fb103048
    Member
    Posted 6 years ago #

    Where in the (excellent, by the way) manual is this deleting stuff explained? HandySolo, your answer was good, I just need more.

    Thank you.

    fb

  4. Chris_K
    Member
    Posted 6 years ago #

    @fb103048 - by delete, I mean open the theme file in your text editor of choice and remove/change/comment the lines of code as ye wish.

    To start, you might just wish to use your ftp tool (may I suggest filezilla?) to download the theme file to your local PC, make your changes (after saving a copy, natch), then upload the file back to your server.

    Now that's a rather impressively long run-on sentence!

  5. lcnewbie
    Member
    Posted 6 years ago #

    Lovely, thanks HandySolo I will try that and see how I get on - your answers as always make perfect sense :o)

    I am currently using two themes (for two very different sites) http://www.ironingman.co.uk and http://www.maternityhealth.co.uk the latter I am having much more success with but the first is for my husbands home based business so I am trying to adapt it purely for info purposes only.

  6. moshu
    Member
    Posted 6 years ago #

    Alternatively, some more advice for the ironingman site:
    Since you are using a lot of Pages, create a page.php template that doesn't have any reference to comments and you can also safely delete the meta section (posted, dtae, category etc. - it's useless for Pages).
    In the sidebar, for the wp_list_pages tag you can give another title than "Pages"
    If you have only one category (Home) do you really need i to be displayed? If you want a homepage-link, you can include it in the Pages navigation (search for several solutions given in this forum).

  7. lcnewbie
    Member
    Posted 6 years ago #

    Thanks Moshu - I am planning on using the static page plugin for my 'welcome' page as with the maternity health site so i can delete the category lising altogether. I am still very much a beginner with php (only started using WP and php last week so still learning!) so how would i create a page.php template?

  8. moshu
    Member
    Posted 6 years ago #

    Just save your index.php as `page.php and delete/edit whatever you don't need :)

    An alternative to any kind of homepage plugin is another one I am using quite often is the get_a_post (or Page) plugin:
    http://guff.szub.net/2005/01/27/get-a-post/
    Another option is to have a home.php template file in the theme folder (made in similar was as the page template) and again edit, delete, include etc.

  9. lcnewbie
    Member
    Posted 6 years ago #

    Cool, thanks - I'll give it a try :) Wish me luck!

Topic Closed

This topic has been closed to new replies.

About this Topic