WordPress.org

Ready to get started?Download WordPress

Forums

Comments for static pages? (12 posts)

  1. error
    Member
    Posted 9 years ago #

    I've created several static pages in 1.3-alpha4 (2004-11-11) and while a Comments (0) link appears at the bottom, there doesn't seem to be any way for a user to leave a comment. How can I enable comments for static pages?

  2. error
    Member
    Posted 9 years ago #

    Hm, as it turns out, this isn't actually implemented! So I went and implemented it. Here are the changes required:
    In wp-includes/template-functions-comment.php
    Change line 28 to read:
    if ( is_single() || is_page() || $withcomments ) :
    Change line 103 to read:
    if (! is_single() && ! is_page()) {
    Now I can post comments to my static pages, but after I hit "Say it!" I get redirected back to the main page, rather than to the static page I was looking at. Any ideas?

  3. error
    Member
    Posted 9 years ago #

    Leave it to me to eventually figure it out myself. The reason it went back to the main page was an omission in wp-includes/template-functions-links.php
    Change line 53 to read:
    return get_page_link($id);
    Voila! I can now comment on static pages, and everything works! Feel free to do whatever you wish with this hack.

  4. FatherLuke
    Member
    Posted 9 years ago #

    I don't get it.

    I want to be able to have comments on my static pages, too.

    How did you do this?
    I can't even get the Comments(0) to show up.

    Do tell... do telll .

  5. Michael Adams (mdawaffe)
    Member
    Posted 9 years ago #

    NOTE: The above is out of date. Editing the core is not required.

    The following assumes you are using the default Kubrick theme for 1.5.

    Do you want this to happen to ALL pages, or just some?

    If ALL

    1. copy page.php (in your current theme's directory) to page.old.php
    2. copy single.php to page.php (now you see why we made a backup)
    3. Tada. If you want the sidebar back, you'll have to find the class="widecolumn" and replace it with class="narrowcolumn" and then put: <?php get_sidebar(); ?>
      right above <?php get_footer(); ?>

    If SOME

    1. Do the same thing, but instead of overwriting page.php copy single.php to a new file: pagecomm.php
    2. Edit pagecomm.php to include the appropriate Template Name hook (you might read the whole article while you're there)
    3. Edit the Page in question and tell it to use the new Template you've just created by selecting the new Template from the "Page Template" dropdown (below the main textbox).
  6. FatherLuke
    Member
    Posted 9 years ago #

    Want it for some / or all ... not sure.

    I shall give `er a spin.

    Thank you sooooo much for the reply, and I will report tonight how it went.

    I love wordpress support forums...

    Okay,
    Father Luke

  7. FatherLuke
    Member
    Posted 9 years ago #

    Works great, on all fronts.

    Thanks again.

  8. iddapidda
    Member
    Posted 9 years ago #

    Hello, was just wondering about this.. what if Kubrick is not the theme in use? is there a way around that?

  9. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    Just add comments_template() to your page template wherever you want the comment form to appear.

    <?php comments_template(); ?>

  10. iddapidda
    Member
    Posted 9 years ago #

    thank you :-)

  11. jbloom
    Member
    Posted 9 years ago #

    Thanks this helped me out too!

  12. almodo
    Member
    Posted 8 years ago #

    @mdawaffe: THANKS THANKS THANKS for the hint!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.