-2

This error appears up when activating a modified theme in Wordpress:

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\wp-content\themes\manifest_v1.1\functions.php on line 59

The functions.php file has been modified to allow "subject" lines to be chosen when posting a comment.

Here is the code:

<?php
$cats=array(
1=>'Category 1',
2=>'Category 2',
3=>'Category 3'
);

function showCats($cats){

?>
<select name="commentCats">
<?php
foreach($cats as $key=>$cat){
?>
<option value="<?php print $key; ?>"><?php print $cat; ?></option>
<?
}
?>
</select>
<?php
}
add_action ('comment_post', 'add_comment_fields', 1);
function add_comment_fields($comment_id) {
            add_comment_meta($comment_id, 'commentCats', $_POST['commentCats'], true);
}
function manifest_comment($comment, $args, $depth){
print $depth;
global $cats;
 $catID = get_comment_meta(get_comment_ID(),"commentCats", true);
 $GLOBALS['comment'] = $comment; ?>
   <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
     <div id="comment-<?php comment_ID(); ?>">
      <div class="comment-author vcard">
         <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>

         <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'),         get_comment_author_link()) ?>
      </div>

      <?php if ($comment->comment_approved == '0') : ?>
         <em><?php _e('Your comment is awaiting moderation.') ?></em>
         <br />
      <?php endif; ?>

      <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
      <?php if($catID){ ?>
      <h3><?php 

      print $cats[$catID]; ?></h3>
    <?php } ?>
      <?php comment_text() ?>

      <div class="reply">
         <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
      </div>
     </div>
<?php 
} 

?>

I can't figure out what the problem is, I have been told it was working on another test machine. I am currently testing the theme on a local machine. I am testing using XAMPP (http://www.apachefriends.org/en/xampp-windows.html) which includes Apache, MySQL, PHP and PHPmyAdmin. I am using a fresh installation of Wordpress version 3.4.1.

Thanks!

Alex E
  • 466
  • 1
  • 6
  • 17
  • I added in all missing semicolons after all statements and I am still getting this error. – Alex E Aug 09 '12 at 16:02
  • Possible duplicate of [Parse error: Syntax error, unexpected end of file in my PHP code](http://stackoverflow.com/questions/11482527/parse-error-syntax-error-unexpected-end-of-file-in-my-php-code). –  Jul 15 '13 at 03:48

1 Answers1

3

Line 36 - you forgot a ; after the call:

<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'),         get_comment_author_link()) ?>

Edit: as I saw from the comments and further looking at the code in eclipse, you are missing quite a few ; after statements:

<?php comment_text() ?>
<?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
Fluffeh
  • 33,228
  • 16
  • 67
  • 80