0 レビュー
0 回答
javascript-wordpressmoveFormが2回目のクリックで機能しない
Twentytwelveテーマに基づいて新しいWordpress子テーマを作成しましたが、phpcomment_reply_linkおよびjsmoveForm関数に問題があります。
私の問題: コメント返信リンクは最初のクリックで正常に機能します。コメントフォームがコメントの下に表示され、コメントを追加したり、返信をキャンセルしたりできます。ただし、返信をキャンセルすると、コメント返信リンクが再度表示されなくなります。コメント返信リンクがあり、正しいように見えますが、クリックしても何も起こりません。
コメント返信によって生成されたリンクの例:
最初のクリック:
<a class="comment-reply-link" data-onclick="return addComment.moveForm("comment-55", "55", "respond", "129")" href="/ego_fotos_design01/?page_id=129&replytocom=55#respond">Kommentar schreiben</a>
2回目のクリック:
<a class="comment-reply-link" data-onclick="return addComment.moveForm("comment-55", "55", "respond", "129")" href="/ego_fotos_design01/?page_id=129&replytocom=55#respond">Kommentar schreiben</a>
これは私が書いた関数です:
function createCommentOut($commentID, $author, $date, $content, $commentImageURL, $isChild){
if($isChild){ $commentType = "comment_type_child"; } else { $commentType = "comment_type_parent"; }
//Get the ID from Current page
$postID = getGundualPostID();
ob_start();
?>
<div id="<?php echo 'comment-' . $commentID; ?>" class ="<?php echo $commentType; ?> comment">
<div class="comment_head">
<span class="comment_headline"><?php echo $date; ?> | <strong><?php echo $author ?></strong></span>
</div>
<div class="comment_content">
<?php if($commentImageURL != false) : ?>
<a href=<?php echo $commentImageURL; ?>>
<img src=<?php echo getGundulaCommentThumb($commentImageURL);?>>
</a>
<?php endif; ?>
<span class="text"><?php echo $content;?></span>
</div>
<div id="" class="reply">
<?php
$replyLinkArray = array(
'reply_text' => __( 'Kommentar schreiben' ),
'depth' => isset( $args['args']['depth'] ) ? $args['args']['depth'] : (int) 1,
'max_depth' => isset( $args['args']['max_depth'] ) ? $args['args']['max_depth'] : (int) 2
);
if (!$isChild) {
comment_reply_link($replyLinkArray, $commentID, $postID);
}
?>
</div>
</div>
<?php
$commentContent = ob_get_contents();
ob_end_clean();
return $commentContent;
}
備考:ログインしていないユーザーの場合、コメントフォームは表示されません。ページ上にありますが、非表示になっています(表示:なし)。したがって、最初のクリックでフォームが表示されるため、これは多かれ少なかれ正しいはずです。
コメントフォーム関数は次のようになります:
function twentytwelve_gundula_comment_form($isOnlyVisibleForLoggedInUsers = false){
// Get Current User
$currentUser = wp_get_current_user();
if($isOnlyVisibleForLoggedInUsers && !($currentUser->exists())){
echo '<div style="display: none;">'."\r\n";
}
comment_form();
if($isOnlyVisibleForLoggedInUsers && !($currentUser->exists())){
echo '</div>'."\r\n";
}
}
jsmoveForm関数で問題が発生したと思います。誰かが何が悪いのか手がかりを持っていますか?
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。