[resolved] Cannot make comments on Pages (Posts OK) (3 posts)

  1. gpetrics
    Posted 6 years ago #

    I run http://www.famousinternetskiers.com and for the life of me I can't figure out why suddenly people can't comment on pages. This is a big problem since this is where most of the discussion on the site takes place. I installed a few plugins, but after uninstalling them, still nothing works. Any ideas? None of the fixes I have looked at from googling seem to work.

    try commenting here


    it won't work!

  2. gpetrics
    Posted 6 years ago #

    well I actually figured this out by myself. It turned out a call to get_posts was interfering with the main loop, and hence the comments were trying to be assigned to another post which had closed comments. Now if I can only figure out how to get the comment information live again, we'll be good to go...

  3. gpetrics
    Posted 6 years ago #

    Solved everything... Just in case anyone runs into somethign like this this, here's a complete description of the problem/solution. I thought it was kind of interesting and it might even help someone else.

    In the middle of my loop on my page that wasn't allowing comments, I was running a custom loop that accessed a random post. I was careful to save the original loop's $post variable as $temp_post (simply by naming $temp_post=$post) and then reinstate it as $post after the custom loop (just by switching back the variable with: $post=$temp_post).

    In the middle of this custom loop I "activated" the random post's data with a call to <?php setup_postdata($post); ?> (note the $post here is the one for the custom loop... NOT the main loop on the page). After I got everything I needed from this custom loop, (as I noted above) I reinstated main loop's $post (by assigning $post=$temp_post).

    My problem was that the custom loop's $post data was still active even though the "correct" $post variable was in memory...

    Basically I had to "reactivate" the main loop's $post data by recalling <?php setup_postdata($post); ?> (this time the variable $post is for the main loop)

    Anyway, interesting problem which I never thought I could solve on my own. Hopefully this helps someone. Sorry if i'm not getting all the terms right... i don't really speak this language and am just figuring all this out on my own. Best,Greg

Topic Closed

This topic has been closed to new replies.

About this Topic