How To Add Comments To WordPress Pages

Total
0
Shares
reduce comment spam

There are some WordPress themes that are coded not to show comments on pages but just individual posts. Its should be fairly easy to add comments to WordPress pages for your theme following this simple WordPress guide.

Typical WordPress themes are comprised of multiple files and usually, the single.php file is used for posts and page.php for pages. To find the correct code to use the login to the WordPress dashboard and open the theme editor. In version 2.7 the editor is under the Appearance module. If you see a warning on the bottom of the editor that the files are not writable then the file permissions of the themes need to be changed to be writable on the hosting account to edit them directly from the WordPress dashboard. The location of the theme’s files are in the themes folder within the wp-content folder in the WordPress directory, The path is: YourWordPressFiles/wp-content/themes/YourTheme

Once in the theme editor, I suggest you first make a backup of the file you are going to be editing. Copy all the code of the page.php file and paste it into a text file and save it on your computer. Next look for the single.php file on the right and click it to open it in the editor. Scroll down and look for the code that calls for the comments, the exact code you need can vary but the clue is that it should have the text comments in it like this:

<?php comments_template(); ?>

What you need to do while looking at your single.php file is investigate the area above and below the comments template code to see what else may need to be included to properly display the comments on your pages. Look at a single post on your blog and see if there is anything shown above and below the comments that may need to be added for example you may need to copy the styling for the comments like this:

<div class=ā€commentsblockā€>
<?php comments_template(); ?>
</div>

You may need to carefully examine the differences between the single.php file and the page.php file to determine what is needed and the exact location to place the comments code. Once you determined what code to copy and the location, copy the correct code and click the page.php file. Paste it in the same area on the page.php file and click Update File. You did make a backup right?

Now open a page on your blog to see if the comments section is showing. If there is a problem restore the page.php file with the backup file you saved on your computer and keep testing.

Because all themes are coded differently I canā€™t possibly cover every conceivable variation out there, for example, some themes may not have a single.php or page.php file. What it really comes down to is to compare a file that has comments showing to one that isnā€™t and add in what is missing.

Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Get notified of the best deals on our WordPress themes.

You May Also Like