Support » Fixing WordPress » Comments for static pages?

  • error

    (@error)


    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?

Viewing 11 replies - 1 through 11 (of 11 total)
  • error

    (@error)

    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?

    error

    (@error)

    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.

    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 .

    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).

    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

    Works great, on all fronts.

    Thanks again.

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

    Ryan Boren

    (@ryan)

    WordPress Dev

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

    <?php comments_template(); ?>

    thank you 🙂

    Thanks this helped me out too!

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Comments for static pages?’ is closed to new replies.