-1

このエラーは、Wordpressで変更されたテーマをアクティブ化するときに表示されます。

解析エラー:構文エラー、59行目のC:\ xampp \ htdocs \ wp-content \ themes \ manifest_v1.1\functions.phpの予期しないファイルの終わり

Functions.phpファイルが変更され、コメントを投稿するときに「件名」の行を選択できるようになりました。

コードは次のとおりです。

<?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 
} 

?>

問題が何であるか理解できません。別のテストマシンで動作していると言われています。現在、ローカルマシンでテーマをテストしています。Apache、MySQL、PHP、PHPmyAdminを含むXAMPP(http://www.apachefriends.org/en/xampp-windows.html)を使用してテストしています。Wordpressバージョン3.4.1のフレッシュインストールを使用しています。

ありがとう!

4

1 に答える 1

3

;36行目-電話の後で忘れました:

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

編集:コメントから見て、Eclipseのコードをさらに見ると、;後のステートメントがかなり欠落しています。

<?php comment_text() ?>
<?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
于 2012-08-09T14:55:21.787 に答える