2013-08-09 4 views
0

저는 워드 프레스 테마를 개발 중이며 게시 날짜와 관련하여 이상한 문제가 있습니다. index.php 페이지, 내가 날짜를 보여 않습니다 삽입 게시물에Wordpress - 날짜가 올바르게 작동하지 않습니다.

enter image description here (그림 확인)

하지만 최대한 빨리 새 게시물이 이전 게시물의 사라의 DAE를 추가 (아래 그림을 확인)

enter image description here

당신은 새로 추가 된 게시물의 날짜가 표시되고 있지만, 이전 게시물의 날짜가 사라진 것을 볼 수 있습니다. 위

<?php if (have_posts()): while (have_posts()): the_post(); ?> 
     <?php get_template_part('content', get_post_format()); ?> 
    <?php endwhile; ?> 
<?php endif ?> 

index.php 파일에있는 코드입니다 아래 content.php 파일의 코드

<div class="row-fluid"> 
    <li <?php post_class("blog-page-post span12"); ?> id="<?php the_ID(); ?>"> 
    <div class="row-fluid"> 
     <?php if (has_post_thumbnail()): ?> 
      <a href="<?php the_permalink(); ?>" class="post-thumb span4"> 
       <?php the_post_thumbnail(); ?> 
      </a> 
     <?php endif; ?> 
      <article class="preview-details <?php echo has_post_thumbnail(get_the_ID()) ? "span8" : "span12"; ?>"> 
       <p class="article-meta"><?php the_author_posts_link(); ?> on <?php the_date(get_option("date_format")); ?></p> 
       <h3 class="playlist-title"> 
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
       </h3> 
       <p class="excerpt"><?php echo string_limit_words(get_the_excerpt(), 55); ?></p> 

      </article> 
      <div class="container-fluid"> 
       <p class="article-meta article-foot-meta muted pull-right"> 
        <?php the_category("&nbsp;&nbsp;/&nbsp;&nbsp;"); ?> 
       </p> 
      </div> 
     </div> 
    </li> 
</div> 

PS입니다 : 내가 사용하는 코드는 두 그건 경우 게시물은 동일한 형식이 당신 생각.

+0

모두 포스트 날짜가 동일를 해결해야

<?php echo get_the_date(); ?> 

사용해보십시오? –

+0

예, 두 게시물의 날짜가 같습니다 –

답변

1

이 the_date()가 첫 번째 게시물에 대한 날짜 (즉, 첫 번째 인스턴스를 표시 다음 날짜()). 같은 날에 게시 된 게시물의 날짜를 반복하려면 날짜 별 서식 문자열과 함께 템플릿 태그 the_time()을 사용해야합니다.

<?php the_time('F j, Y \a\t g:i a'); ?> or 

<?php the_time(get_option('date_format')); ?> 
1

당신이 시도 할 수있는

같은 날 출판 한 페이지에 여러 개의 게시물이 있습니다
<?php the_time('F j, Y \a\t g:i a'); ?> 
+0

이미 시도했습니다! 나를 위해 일하지 않았어. –

+1

업데이트 된 것을 사용해보세요. –

+0

죄송합니다. 답변을 잘 못 보았습니다. 즉, the_time (get_option ('date_format')) '을 사용하여 저에게 효과적이었습니다. 감사 –

0

워드 프레스 문서는 "같은 날 출판 한 페이지에 여러 개의 게시물이있는 경우, the_date() 첫 번째 게시물에 대한 날짜를 표시합니다"고 mentiones. 문제 :

관련 문제