Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Theme designer in need of coding help

  1. #1
    Nicki is offline Hello World
    Join Date
    May 2009
    Location
    Birmingham, AL
    Posts
    6

    Icon Bug Theme designer in need of coding help

    A couple months ago, I released a new theme called Black Hat. I've been working on some extensive updates to it and have gotten a lot of useful feedback from my users. However, a handful of users have been having problems with comments either missing or showing up on the wrong posts. Each user experiencing this has told me that the problem is corrected when they switch to another theme. I've so far been unable to duplicate this, and am reluctant to release my next update until I know that this is resolved.

    The comment files in the version of my theme that is currently available in the WordPress Theme Repository are the very same in my "updated" version in my test environment, so I know that this would not be fixed by my pending update. The way it's currently setup is for 2.7 and a legacy comments file for 2.6 (I am no longer supporting 2.5 or earlier).

    I've run across possible solutions in the WordPress Support forums and via Google search, but none have worked for my users having this problem. (here and here the most recent I've found)

    I'm stuck and any help would be greatly appreciated! Would you prefer to download the current available version, or if needed, I can post some of my updated coding to pastebin? Please let me know.

    Thanks!

    Nicki

  2. #2
    dancole's Avatar
    dancole is offline Tavern Regular
    Join Date
    Jan 2009
    Location
    USA
    Posts
    237

    Default

    You might have trouble finding someone that's willing to hunt down the problem for you. I think most people, my self included, just like answering detailed questions. Fixing this problem could involve check through a lot of foreign code, reproducing the problem and then backtracking the problem.

    If the problem can be fixed by switch themes, then comparing your theme's code to another one's is going to be your best bet at finding the problem.

    I would find a quality theme, such as the default theme, Thematic, or Hybrid Theme and take a look at their comments.php. Most themes just copy the default theme's comments.php, because it's tested to work perfectly. I can't really say off hand why some comments would be misplaced, because the normal way the comment fetching function gets comments is based on post id. So if you only get one's with id=1, how would you end up with some that have id=2?

    If that doesn't work, how about putting some code up on pastebin. In particular, the part where the post calls for the comments, the comments are fetched and then displayed.
    Dan Cole, Future Engineer.

  3. #3
    andrea_r's Avatar
    andrea_r is offline WordPress Rockstar
    Join Date
    Jan 2009
    Location
    Eastern Canada
    Posts
    1,325

    Default

    Or it could be a problem with that them and a particular plugin.

  4. #4
    itsananderson's Avatar
    itsananderson is offline Big Tipper
    Join Date
    Jan 2009
    Location
    Terre Haute, IN
    Posts
    354

    Default

    Maybe, but that would seem kind of strange.

    I downloaded the theme and looked at comments.php and it's a bit of a mess :)

    I'd suggest going back to the comments from the default theme from 2.7 and starting over, being careful to keep HTML tags matched and so on.

  5. #5
    andrea_r's Avatar
    andrea_r is offline WordPress Rockstar
    Join Date
    Jan 2009
    Location
    Eastern Canada
    Posts
    1,325

    Default

    I've only encountered the issue once before, can't remember what fixed it.

  6. #6
    Nicki is offline Hello World
    Join Date
    May 2009
    Location
    Birmingham, AL
    Posts
    6

    Default

    Quote Originally Posted by dancole View Post
    You might have trouble finding someone that's willing to hunt down the problem for you. I think most people, my self included, just like answering detailed questions. Fixing this problem could involve check through a lot of foreign code, reproducing the problem and then backtracking the problem.

    If the problem can be fixed by switch themes, then comparing your theme's code to another one's is going to be your best bet at finding the problem.

    I would find a quality theme, such as the default theme, Thematic, or Hybrid Theme and take a look at their comments.php. Most themes just copy the default theme's comments.php, because it's tested to work perfectly. I can't really say off hand why some comments would be misplaced, because the normal way the comment fetching function gets comments is based on post id. So if you only get one's with id=1, how would you end up with some that have id=2?

    If that doesn't work, how about putting some code up on pastebin. In particular, the part where the post calls for the comments, the comments are fetched and then displayed.

    Thanks for the reply. This was kind of a "shot in the dark" post. My hopes were that maybe someone here had run across this kind of thing before.

    I've been comparing my theme's coding to several other 2.7-ready ones and haven't seen a whole lot of difference (as it's not using a callback ~yet~, just one more thing on my "to do" list of updates).

    For grins and giggles, I pulled up my original release and it works beautifully -- which tells me that the problem is most likely in my functions.php file, as it has been the most heavily modified in my last 2 updates (the actual comments.php file has not changed since the original release). So, in essence, I made things worse by trying to make things better.



    Quote Originally Posted by andrea_r View Post
    Or it could be a problem with that them and a particular plugin.
    I had thought of that, but hadn't found a common plugin being used by all users experiencing this problem. :::shrug:::



    Quote Originally Posted by itsananderson View Post
    Maybe, but that would seem kind of strange.

    I downloaded the theme and looked at comments.php and it's a bit of a mess :)

    I'd suggest going back to the comments from the default theme from 2.7 and starting over, being careful to keep HTML tags matched and so on.

    Heh, yeah, it is. Code clean-up is on the top of my next release "todo" list. It's based on Sandbox, and I've modified it a bit to fit my layout. I'll definitely be going back and looking over things to see where I can improve and/or simply.



    Quote Originally Posted by andrea_r View Post
    I've only encountered the issue once before, can't remember what fixed it.

    Thanks anyways for the replies. I think what I need to do now is remove all of my "improvements" and start over.

    Thanks, guys.

  7. #7
    Otto's Avatar
    Otto is offline On The Rocks
    Join Date
    Apr 2009
    Location
    Memphis, TN
    Posts
    862

    Default

    The comments.php has some odd bits in it. Minor stuff.

    The check for function_exists('post_password_required') is unnecessary. You already have the legacy.comments.php file, you don't need to check for it there as they got introduced in the same version.

    Instead of doing things like if ('open' == $post->comment_status) you should use if (comments_open()). That applies everywhere, BTW, that function's been around for ages.

    Instead of if ( $user_ID ), try if ( is_user_logged_in() ).

    But, looking through it, I see nothing in there that can cause the symptoms you're describing. The wp_list_comments call is straightforward, the comment_id_fields are correct in both of them so the parent/child relationships can't get easily messed up.

    The only thing I can see is a potential problem where:
    a) They're not running 2.7 and so are using the legacy comments file, and
    b) They messed with their main post loop in such a way as to change the value of the $id variable.

    That stems from this line:
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />

    If the $id gets messed up, then a submitted comment might be going to the wrong post.

  8. #8
    Nicki is offline Hello World
    Join Date
    May 2009
    Location
    Birmingham, AL
    Posts
    6

    Default

    Quote Originally Posted by Otto View Post
    The comments.php has some odd bits in it. Minor stuff.

    The check for function_exists('post_password_required') is unnecessary. You already have the legacy.comments.php file, you don't need to check for it there as they got introduced in the same version.

    Instead of doing things like if ('open' == $post->comment_status) you should use if (comments_open()). That applies everywhere, BTW, that function's been around for ages.

    Instead of if ( $user_ID ), try if ( is_user_logged_in() ).

    But, looking through it, I see nothing in there that can cause the symptoms you're describing. The wp_list_comments call is straightforward, the comment_id_fields are correct in both of them so the parent/child relationships can't get easily messed up.

    The only thing I can see is a potential problem where:
    a) They're not running 2.7 and so are using the legacy comments file, and
    b) They messed with their main post loop in such a way as to change the value of the $id variable.

    That stems from this line:
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />

    If the $id gets messed up, then a submitted comment might be going to the wrong post.

    Hey Otto, thanks for the reply! So far, only 2.7 users have reported this problem. Thanks for the suggestions!

  9. #9
    Nicki is offline Hello World
    Join Date
    May 2009
    Location
    Birmingham, AL
    Posts
    6

    Icon10

    Thanks everyone for your help. Something clicked when one of my users made the comment that it only acted up for him when there were related posts. Once I removed the Related Posts coding, it started working fine. So for now I'll have to find another way to implement that.

    Thanks so much for your guidance!


    Nicki

  10. #10
    andrea_r's Avatar
    andrea_r is offline WordPress Rockstar
    Join Date
    Jan 2009
    Location
    Eastern Canada
    Posts
    1,325

    Default

    There's a few related posts plugin out there, so just try another one.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •