• Hi all,

    First off, I LOVE WordPress. It’s been a breeze to install, configure and get running. Two very enthusiastic thumbs up. Fine family fun.

    Anyway, I was wondering how you would go about adding the “comments” feature to non-Wordpress pages. Is it possible? I’ve custom written a number of pages which are quite complicated as is; all I want it to tack on the Comments feature at the bottom to allow people to remark on the page content.

    Any suggestions would be most appreciated! ??

Viewing 15 replies - 1 through 15 (of 16 total)
  • Convert your non-WP pages to WordPress Pages maybe? Then you can have comments.

    Otherwise… no clue… can’t have a comment in WP without an associated Post/Page to hang it off of.

    Well, if you’ve got a few days (in other words, if you’re not on deadline….), I’ll write up what I did to make this sort of thing work.

    But I won’t be able to get back to this until a week from today maybe.

    I know I would be rather interested to hear about it, vkaryl.

    Yah – I’ll post it here when I get back and get it into some sort of “might make sense” order. I had to do a really dirty hack to get it working right in an immediate sense (clients, y’know….), and I want to definitely try to get that part of it together without such a nasty workaround.

    Will definitely be next week – I have the week from hell here beginning tomorrow at 0-dark-30.

    In the meantime, you can see what I did for this particular client (including the extremely nasty hack) at https://payrollemploymentgame.com/commentloop.php

    Yes, I am trying to do exactly the same thing! Everything else on my site runs off a mySQL DB, too, so I was planning to hack the comment function to allow it to associate comments with another key.

    Haven’t had time yet to dig through and figure out exactly how the comment functions work, though, so I’m curious to see/hear how someone else has done it. Thanks in advance!

    Y’know, I’m COMPLETELY embarrassed to say that I totally forgot to write this up. So I’m glad kiralmarch resurrected the thread. I’ve noted this on my paper planner and my PDA to-do list; I’ll try to get it together by the weekend.

    Sorry!

    I can’t even reconstruct the ugly hack, since for some reason, I didn’t keep a copy of the previous file.

    What I finally wound up doing was simply to install an instance of wp in its own subfolder after creating the database. Then on the commentloop.php page (which resides in site root), I input the following as the very first line of the file (above even the doctype):

    <?php require('/home/username/public_html/wpfoldername/wp-blog-header.php'); ?>

    which means that any comments left through the page get saved to the database per normal, and display according to standard criteria in wp-options.

    Had the client not been pushing for “instant”, I would no doubt have figured that out first!

    … and just to be out of left-field, I recently found this nifty little thing: https://js-kit.com/

    Oh. Wow. Okay, you can come…. (and if you get THAT ref, you’re better than most….)

    Broken Arrow is about the only movie coming to mind. Am I close?

    Spot on! You’re only the second person in 10 years to get that….

    Loved that movie. ??

    “When we have to go to war against Utah, we’re going to kick a**, ya know?”

    I was living in Utah when I saw the movie, that line cracked me up pretty hard.

    It cracks me up EVERY TIME I watch it – because I’m STILL living in Utah! “Scare the cows, wake the farmers….”, not to mention “Wow.” “Yeah. That was a first for me too.”

    I watch it several times a year – a guaranteed good time. Gonna have to find a dvd one of these days….

    That js-kit.com thing would be great, except that I can’t get it to work with my dynamically generated URLs. Posted on the thread there, and no one has been able to help. ??

    Vkaryl, thanks for posting your soln. I’m not sure I completely understand what you did, but I don’t think I want to do exactly the same thing. I want to put add/view comments on *many* non-wp pages on my site — a few thousand photo pages. I think it’s going to require hacking the post/comment ID system.

    It looks possible, but I’ll probably break a bunch of stuff along the way. :-/

    One problem: Without an associated ID in the wp_posts table, comments won’t be recognized as open so people won’t be able to make them. The best workaround seems to be modifying the check for comment status in wp-comments-post.php so I can tell it to treat comments as open. (I think that’s better than adding dummy posts to the wp_posts table, and I don’t mind not being able to close comments on a post easily.)

    Another (smaller) problem: In reading comments out of the DB, I’ll have to come up with an ID system for them that won’t interfere with the association of regular comments with wp_posts. Since it’s a numeric field, the only option I see is to start at the max value for the field and count down, betting that it will never meet my post count. (A good bet.) I can automatically assign that ID when I create each non-WP page.

    Final problem: I’ll have to modify the comment_template function, since it looks up the post ID…I think I’ll have to feed it the post ID as a parameter and only let it look up if the parameter is null.

    If anyone’s found a different way or has other thoughts, let me know!! Otherwise, I’ll tackle it this weekend, and let you know how it works out. Good thing it’s going to rain…

    Yes, please post back how it’s going. At this point, you might like to start a new thread….

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Adding “Comments” to non-WordPress Pages’ is closed to new replies.