Support » Fixing WordPress » Cannot make comments on Pages (Posts OK)

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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…

    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot make comments on Pages (Posts OK)’ is closed to new replies.