• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WPArena

WPArena

WPArena is a premium online resource site of WordPress and is focused on providing excellent WordPress Tutorials, Guides, Tips, and Collections.

  • News
    • Opinion
  • Tutorials
  • Reviews
    • Themes
    • Plugins
  • Comparisons
  • Collections
    • Education Themes
    • Genesis Child Themes
    • Best Responsive Themes
    • Medical WordPress Themes
    • Finance & Business Themes
    • Crowdfunding Themes
  • Resources
    • Inspiration
  • Services
WPArena » Tutorials
Tutorials

How To Add Comments To WordPress Pages

Avatar of Editorial Staff Editorial Staff February 8, 2009

reduce comment spam
FacebookTweetPinLinkedInEmailPrint

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.

FacebookTweetPinLinkedInEmailPrint

Related Stories

  • 7 Ways to Customize Your New WordPress Blog for Your Personal Brand

    7 Ways to Customize Your New WordPress Blog for Your Personal Brand

  • How To Use HTML5 With WordPress Theme Development

    How To Use HTML5 With WordPress Theme Development

  • How To Create A Custom WordPress Page Template

    How To Create A Custom WordPress Page Template

Avatar of Editorial Staff

Editorial Staff

Editorial Staff at WPArena is a team of WordPress experts led by Jazib Zaman. Page maintained by Jazib Zaman.

Reader Interactions

Share Your Thoughts Cancel reply

Before submitting your comment, we kindly ask that you read our comment policy. Your email address will remain confidential and will not be published or shared anywhere. If you subscribe, you will receive notifications regarding new comments.

Primary Sidebar

PSD to XHTML CSS Design Service Providers and Tutorials

Swiss army knife image

WPMU DEV – The Swiss Army Knife of WordPress

Recent Topics

  • 27 Top SEO Companies in the World
  • 12 Ways To Monetize Your WordPress Blog
  • Comparing the Best Employee Engagement Software in the Market
  • Stellar Converter for OST Review: Best Tool for OST to PST Conversion
  • How To Use WordPress as an eCommerce Store

Footer

Top

  • Services
  • Our Themes
  • Facebook
  • Twitter
  • Linkedin

Reviews

  • Beaver Builder Review
  • Beaver Themer Review
  • WP User Frontend Pro
  • Ninja Forms Review
  • MemberPress Review

More Reviews »

Resources

  • Best WordPress Plugins
  • WordPress Permalinks Structure
  • Email Management System
  • Envato Free Files
  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact

Copyright © 2023 · All Rights Reserved · WPArena is a Project of TechAbout LLC.
We are not affiliated with Automattic or WordPress.

  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact
Share this ArticleLike this article? Email it to a friend!

Email sent!