2016-08-22 3 views
1

나는 많은 것들을 시도한 것처럼 느껴진다. 그래서 나는 도움을 청하기 위해 여기에있다. 다른 사람들을 위해 일한 것은 나를 위해 일하지 않았습니다. 중첩 된 주석을 넣으려고 노력하고 있지만 작동시키지 못합니다. 답장을 보내려는 댓글 아래에 답장 형식이 표시되기 때문에 상황이 이상합니다. 그러나 게시물을 치면 작동하지 않습니다. 또한 URL을 보면 # comment- (일부 값)에서 # respond- (일부 값)로 변경되지 않습니다. 내 Chrome Inspector 탭에 js가 제대로로드되고 있음을 알 수 있습니다. 나는 코멘트 답장을 적절하게 큐잉하고있다.Wordpress 답글 덧글 Link

스크립트를 다른 방식으로 대기열에 추가하고 permalinks를 기본값으로 재설정하고 수많은 코드를 변경했지만 아무 것도 작동하지 않는 것 같습니다. 어떤 도움이라도 대단히 감사하겠습니다. 나는 주위를 검색해 보았지만 비슷한 문제가있는 해결책이나 사람을 찾을 수 없었습니다.

[수정] : 내 inspector 탭에 comment-reply.js가 제대로로드 된 것을 볼 수 없습니다. 나는 그것을 내 header.php에서 wp_head 위에 blahblahblah를 놓아서로드하려고 시도했지만,로드했지만 아무런 효과가 없었다.

Single.php :

<?php 

     if(comments_open()) { 

       comments_template(); 

      } 

      ?> 


     <?php endwhile; 

    endif; 

?> 

Comments.php :

<?php if(have_comments()): ?> 

<h4 id="comments"><?php comments_number('No Comments', 'One Comment', '% Comments'); ?></h4> 

<ol class="commentlist"> 
<?php wp_list_comments(array(
    'callback' => 'ericshio_custom_comments', 
    'max-depth' => 'x', 
)); ?> 
</ol> 

<?php else : ?> 

    <p class="no-comments">No comments yet</p> 

<?php endif; ?> 

<?php 

    $comments_args = array(
     // Change the title of send button 
     'label_submit' => __('Post', 'ericshio'), 
     // Change the title of the reply section 
     'title_reply' => __('Write a Reply or Comment', 'ericshio'), 
    ); 

?> 

<?php comment_form($comments_args); ?> 

Functions.php :

여기

내가 사용하고있는 코드와 그 안에있는 파일입니다
/* Custom Comments */ 

function ericshio_enqueue_comments_reply() { 
    if(get_option('thread_comments')) { 
     wp_enqueue_script('comment-reply'); 
    } 
} 

add_action('comment_form_before', 'ericshio_enqueue_comments_reply'); 

function ericshio_custom_comments($comment, $args, $depth) { 
    $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>        

     <div class="comment-wrapper"> 

     <?php comment_text() ?> 

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

     </div> 

     </div> 

    </div> 
<?php 

} 
+1

내가 – Isaac

+0

하하하 당신은 무엇을 사용합니까 워드 프레스에 접촉하지 않는 이유는?: P – ERIC

+0

wordpress 코멘트 시스템은 어리석게도 이상하고 복잡합니다. 특히 나는이 모든 것을 매우 초보자로하고 있습니다. 또한 코덱스는이 주제에 대한 많은 정보를 제공하지 않습니다. 특히 다른 참조 자료와 비교할 때 특히 그렇습니다. – ERIC

답변

1

이 b를 읽어야합니다. 과거와 같은 문제가 생겨서 여기에서이 문제를 해결했습니다.

https://codex.wordpress.org/Template_Tags/wp_list_comments#Comments_Only_With_A_Custom_Comment_Display

참조 : codex.wordpress.org

편집 :

if (is_singular()) wp_enqueue_script('comment-reply'); 

는 그 코드가 의견 회신을 추가header.php에서

이 줄 wp_head() 추가 단일 게시물 페이지에 자바 스크립트.

그래서, 당신의 의견 양식을 추가 할 새 매개 변수가 있습니다이 의 코멘트 양식 제목을 만드는

<?php comment_id_fields(); ?> <a id="respond"></a> <h3><?php comment_form_title(); ?></h3> 

<?php comment_form_title('Leave a Reply', 'Leave a Reply to %s'); ?> 

"회신을 남겨주의"%s 것이다 그 사람의 이름으로 대치되어야한다. 이것은 자바 스크립트가 작동하지 않을 때만 발생합니다.

<div id="cancel-comment-reply"> 

<small><?php cancel_comment_reply_link() ?></small></div> 

다음은 사용하기 쉬운 일반적인 원칙입니다.

refernce를 : OttoPress

+0

이봐, 나는 이것을 여러 번 읽었다. 그게 정확히 당신 문제를 해결 한 것입니까? – ERIC

+1

귀하의 주요 문제는 답장입니다. 맞지? – Noman

+0

예, 맞습니다 :) – ERIC