2016-06-05 5 views
0

나는 wordpress를 사용하는 법을 배우려하고있다. 댓글 레이아웃을 변경하려고하고 댓글 날짜에 참여하여 작성자 데이터에 댓글을 달려고합니다. 그러나 나는 그것을 얻지 못하고있다. 예를 들어 첫 번째 이미지에는 무엇이 있지만 두 번째 이미지에 원하고 있습니다. 제발 도와 줄 수있어? 정말 고마워! enter image description here덧글 작성 날짜 덧글 div 작성자 Wordpress

+0

당신은 어떤 게시물의 루프 코멘트 날짜를 원하는 :

다음은이에 대한 원래의 WP 설명서입니까? – Coder

+0

모든 코멘트에 날짜가 필요합니다. 나는 그 위치를 바꾸고 싶지만 그것이 어디에 있는지를 알지 못한다. 나는 worpress가 나를 위해 그것을 창조한다고 생각한다. –

+0

그 링크를 보내 주시겠습니까? – Coder

답변

1

enter image description here

나는 당신의 주요 문제는 당신이 날짜에만 CSS를 사용하여 배치되는 방식을 사용자 정의 할 수 있지만 매우 어려운 것으로 생각합니다. 가장 좋은 방법은 나만의 맞춤 의견 코드를 작성하는 것입니다.

Wordpress는 여러분의 의견을 말씀해주십시오.

wp_list_comments(array(
    'style'  => 'ol', 
    'short_ping' => true, 
    'avatar_size' => 42, 
)); 

당신은 같은 것을 수행 할 수 있습니다 :

<ol class="commentlist"> 
<?php wp_list_comments('type=comment&callback=mytheme_comment'); ?> 
</ol> 

을 그리고 당신이를 추가 할 수 function.php 파일에이 일을 대신 주석 템플릿 코드를 호출 예를 들어

mytheme_comment 함수는 wp가 가지고있는 원래 주석 코드를 가지고 클래스와 html 코드 배치를 재 배열하여 원하는 날짜를 가질 수 있습니다.

function mytheme_comment($comment, $args, $depth) { 
    if ('div' === $args['style']) { 
     $tag  = 'div'; 
     $add_below = 'comment'; 
    } else { 
     $tag  = 'li'; 
     $add_below = 'div-comment'; 
    } 
    ?> 
    <<?php echo $tag ?> <?php comment_class(empty($args['has_children']) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>"> 
    <?php if ('div' != $args['style']) : ?> 
     <div id="div-comment-<?php comment_ID() ?>" class="comment-body"> 
    <?php endif; ?> 
    <div class="comment-author vcard"> 
     <?php if ($args['avatar_size'] != 0) echo get_avatar($comment, $args['avatar_size']); ?> 
     <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()); ?> 
    </div> 
    <?php if ($comment->comment_approved == '0') : ?> 
     <em class="comment-awaiting-moderation"><?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 
     /* translators: 1: date, 2: time */ 
     printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()); ?></a><?php edit_comment_link(__('(Edit)'), ' ', ''); 
     ?> 
    </div> 

    <?php comment_text(); ?> 

    <div class="reply"> 
     <?php comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> 
    </div> 
    <?php if ('div' != $args['style']) : ?> 
    </div> 
    <?php endif; ?> 
    <?php 
    } 

는 기본 코드에서 당신은 코드를 볼 수 있습니다

<?php 
     /* translators: 1: date, 2: time */ 
     printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()); 
    ?> 

는 당신에게 최신의 정보를 제공하는 것이다.

당신이 이것을 이해했기를 바랍니다. wp list comments

+1

내 문제는 내가 주석 기본 코드를 찾지 못했지만, 확실히 작동합니다. 정말 고마워. –