views:

29

answers:

0

I made a custom page that is based off archives that shows the post excerpt then a button which on click slides down to show whole post. It works great but I try to include the comments template in there and then jQuery breaks, wont slide. If I firebug in and remove the display:none then it shows and everything, even comments, are in there. This is theme I am modifying form someone and it is from Obox. This is the code that breaks it in their comments.php file, if I remove this function it works. Any idea why? Thank you!

<?php 
function fetch_comments($comment_id, $i)
{  
global $wpdb;
require('wp-load.php');
$sql = "SELECT * FROM $wpdb->comments WHERE comment_parent = ".$comment_id;
$child_comments =  $wpdb->get_results($sql);    
$parent_comment = get_comment($comment_id);
$thread_count = 0;
if(count($child_comments) !== 0) :
$thread_count++ 
?>
<div class="threaded-comments clearfix">
<?php
foreach($child_comments as $sub_comment) :
$this_comment = get_comment($sub_comment->comment_ID);
$comment_table = $wpdb->prefix . "ocmx_comment_meta";
$sub_comment_meta_sql = "SELECT * FROM $comment_table WHERE commentId = ".$sub_comment->comment_ID." LIMIT 1";
$sub_comment_meta = $wpdb->get_row($sub_comment_meta_sql);
?>
     <div class="thread-comment clearfix">
            <div class="user clearfix">
 <?php echo get_avatar( $this_comment, 80 ); ?>
            </div>
            <div class="comment-post">
             <h4 class="comment-date"><?php echo date('F d Y', strtotime($sub_comment->comment_date)); ?> <?php echo date("H\:i a", strtotime($sub_comment->comment_date)); ?></h4>
                <h3>
                 <?php if($sub_comment->comment_author_url !== "http://" && $sub_comment->comment_author_url !== "") : ?>
                       <a href="<?php echo $sub_comment->comment_author_url; ?>" class="commentor_url" name="comment-<?php echo $sub_comment->comment_ID; ?>" rel="nofollow"> <?php echo $sub_comment->comment_author; ?></a>
                    <?php else : ?>
                         <?php echo $sub_comment->comment_author; ?>
                    <?php endif; ?>
  <?php if($sub_comment_meta->twitter !== "") : ?><a href="http://twitter.com/&lt;?php echo $sub_comment_meta->twitter; ?>"  class="twitter-link" rel="nofollow">@<?php echo $sub_comment_meta->twitter; ?></a><?php endif; ?>
                </h3>
               <?php if ($sub_comment->comment_approved == '0') : ?>
                    <p>Comment is awaiting moderation.</p>
                <?php else :
                    $use_comment = apply_filters('wp_texturize', $this_comment->comment_content);
                    $use_comment = str_replace("\n", "</p><p>", $use_comment);
                    echo "<p>".$use_comment."</p>";
                endif; ?>
            </div>
        </div>
<?php
endforeach;
?>
</div>
<?php
endif;
}?>

`