dpwh11290 2014-10-17 09:14
浏览 28

wordpress moveForm无法在第二次点击时工作

I made a new Wordpress child-theme based on the Twentytwelve theme and I have some issues with the php comment_reply_link and js moveForm function.

My Problem: My comment reply link works fine on the first click, the comment form will be displayed under the comment and I can add comments or cancel the reply. But when I cancel the reply, the comment reply link will not be shown again. The comment reply link is there and looks correct, but nothing happens on click.

Example of Link generated by comment reply:

First click:

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

Second click:

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

This is the function I have written:

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;

}

Remarks: For not logged in user the comment form will be not displayed. It is on the page, but hidden (display: none). So this must be more or less correct, because on the first click the form will be displayed.

My comment form function looks like this:

function twentytwelve_gundula_comment_form($isOnlyVisibleForLoggedInUsers = false){

    // Get Current User
    $currentUser = wp_get_current_user();

    if($isOnlyVisibleForLoggedInUsers && !($currentUser->exists())){
        echo '<div style="display: none;">'."
";
    }

    comment_form();

    if($isOnlyVisibleForLoggedInUsers && !($currentUser->exists())){
        echo '</div>'."
";
    }

}

I think somthing went wrong with the js moveForm function. Do anybody has a clue what is going wrong?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器