• Resolved peterdouglas

    (@peterdouglas)


    A while ago, when I started my website, I thought I just wanted to have it “magazine style” and publish articles while not allowing comments. But now I’m thinking that I’d like to allow people to comment on blog posts.

    Stupidly, I believe I actually removed code from the WordPress files. Out of frustration, I did that. Now I am older and wiser and know how to disallow comments through the checkbox under “screen options” as well as through the Thesis theme and skin I am using.

    It’s been so long that I really don’t remember which file I edited to remove the commenting – or if it was WordPress code or theme code. Seems to me I removed a fair bit of code, because I didn’t want it to say “0 Comments” or “Comments Closed” so I probably removed the code for that too. Since this website has now grown to get a fair amount of regular traffic I don’t want to experiment with activating other themes or playing around with the code and possibly breaking the site. Which file would I look at to see if I’ve hacked it? Maybe I could just copy an unedited version of that file from another one of my WordPress sites?

    The website in question is https://afterbankruptcycanada.ca/

    Thank you in advance for any tips and suggestions!

Viewing 15 replies - 1 through 15 (of 23 total)
  • I would go thru a new copy of wordpress and check for any file comment*.php and ftp the new file to the site.

    Thread Starter peterdouglas

    (@peterdouglas)

    I don’t think I commented anything, unless you mean look for the commenting put there by WordPress?

    I guess it wouldn’t hurt to upload and write over one file at a time, providing there’s a backup of the current version so it can be restored if needed. Any hints on which files I should look at first? I’m not a very proficient coder – I just know enough to get into trouble, lol!

    Do you know the name of the theme you are using and the version of WordPress you’re running? Adding comments back in is pretty simple, especially if we knew those two things.

    Does your theme have a file under appearance >> editor called single.php?

    I am talking about files with the name of
    “comment”.

    Ok, so you think you deleted the comments.php file? What’s your theme’s name?

    Thread Starter peterdouglas

    (@peterdouglas)

    I’m using the “Thesis” theme along with a skin called “Thesis Play” (both premium paid products). I’m using WordPress 3.2.1 (the most current as of this posting).

    I think you guys gave me a hint… I’m going to do some looking around, but again, I’m really an amateur at this, so I could be looking in the wrong places.

    Great. I checked and https://afterbankruptcycanada.ca/wp-content/themes/thesis_18/comments.php does seem to be on your server, so I don’t think you deleted the comments.php file.

    The other thing you could do is check to see if the call to include comments was deleted or commented out. It appears as though the comments DIV is still there, and on some much older posts I see some trackbacks, so my guess would be that the call to comments is missing.

    I would look in your single.php file under Appearance >> Editor and see if you can locate the contents of the “comments” DIV near the bottom and post them here so we can take a look.

    Thread Starter peterdouglas

    (@peterdouglas)

    Hi, thanks for the tips! I had also posted my question on the support forum for the Thesis Play skin. The creator of the skin just replied back and said that Thesis Play should have nothing to do with the comments, except for the styling. Unless it’s in the parent theme (Thesis). But I have a feeling I probably used Dreamweaver back then to delete or comment out some code for the comments.

    The theme does not seem to use a file called single.php – at least, I cannot find a file with that name anywhere. Which WordPress files are likely to contain code for the commenting? I’m going to look through and see if I can find that, and then compare to an unedited version of WordPress. Unfortunately none of the WordPress updates overwrote my edits, lol!

    Do you see an index.php file when you go to Appearance >> Editor? This would be the next most likely place to find the comments code. As I said before, I can see the comments DIV there, so I would look at the PHP code and see if it’s calling the comment hook.

    Looking at the file structure for Thesis, my guess would be the next likely place to look after that would be wp-content/themes/thesis_18/index.php.

    Another place to look is at the comments.php file located in the thesis_18 folder. As I said before, I know there was a few trackbacks listed on some older posts, so I guess it’s possible that maybe just the comments code was edited and the trackbacks were left in place.

    Let us know how that pans out.

    Thread Starter peterdouglas

    (@peterdouglas)

    Thanks again! I had thought of index.php but it contains hardly any code, just:

    <?php
    /**
     * Cue the star of the show...
     *
     * @package Thesis
     */
    thesis_html_framework();
    ?>

    (That’s actually the same index.php as seen through Appearance >> Editor as well as by going directly to wp-content/themes/thesis_18/index.php). Unless I’m missing something, that doesn’t look like the code I want.

    Thanks for the Thesis File Structure. I checked all other files called comments.php and index.php and compared from an unedited website to this one. The all had the same amount of lines and I did not see any code commented out.

    Back when I originally set up this website, I was mostly concerned about not having comments, so probably didn’t mess with trackbacks. I’m not sure where that code is being called from. Is it possible that I might have edited a WordPress file and not a Thesis file?

    Is it possible that I might have edited a WordPress file and not a Thesis file?

    Yes.

    Replace these files for the version of wp you have via ftp:
    root – wp-comments-post.php
    wp-admin – comment.php
    wp-includes – comment-template.php; comment.php; functions.php

    These are likely files from which you may have removed code.

    Based on what you posted, I would check the files inside the HTML folder:

    # html/

    * content_box.php
    * footer.php
    * frameworks.php
    * header.php
    * hooks.php
    * sidebars.php
    * templates.php

    There’s also a functions/comments.php file, but I doubt you were editing that in Dream Weaver.

    It is possible you overwrote a WP file, but if it was a WordPress core file then it would have been overwritten when you made your last upgrade.

    To be honest with you, without having any real idea of what you have or haven’t edited, the way to go may be to backup your theme and just reload it to the FTP site.

    I would start with the Thesis Play child theme first, then Thesis, then WordPress. I seriously doubt it’s WordPress though, because you’re on the most recent version.

    Thread Starter peterdouglas

    (@peterdouglas)

    Hey guys, thanks again for the tips! I just posted my question on the Thesis support forum too, seriously doubting it was a Thesis issue. But, after a couple of suggestions, someone tipped me off that there were two places in the Thesis theme that comments can be controlled (under Display Options and Comment Options). I did not know that – I thought I had allowed commenting but did not know of the second section.

    So, the good news is that I now have commenting enabled! Looks like I did not do any hard coding after all, although I was sure I had. At least now I know where to look if I run into this again. I have a feeling one of my other sites may have been hard coded to remove commenting… But the bad news is that it looks like I have to manually edit each of the 30+ posts to individually enable commenting.

    Since we’re on the topic of commenting, is there a way I can enter the words “Optional” beside or below the fields that say “Name” “Email” and “Website”? Being a sensitive subject (Bankruptcy), people may not feel comfortable leaving any identifiable info, and I don’t want them to think it’s mandatory that they give any of it. Can I have only the comment box and submit button appear?

    Thanks! ??

    In the comments.php file of your theme. Look for “name” etc. and then put Optional right after it.

    Thread Starter peterdouglas

    (@peterdouglas)

    Thanks! I had actually looked at that file, but not being a very strong programmer, I was afraid to tamper with it. In the past, I’ve made edits to PHP files and made the site inaccessible and had to restore the original file though FTP.

    Here’s the entire comments.php file. Can I add “Optional” (with double quotation marks). For example:

    'comment_author' => "Optional" $comment_author,

    Or is that the wrong way? I don’t want to break the PHP and make the site go down. One wrong character can do that. Ask me how I know, lol!

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Long ago I edited the code to remove commenting, how can I put it back?’ is closed to new replies.