2012-12-06 7 views
0

"오디오"라는 맞춤 게시 유형이 있습니다. 페이지의 모든 게시물을 표시하려면 아래 코드를 작성했으나 작동하지 않습니다.페이지에 맞춤 게시물 유형 게시물 표시

  <?php 
    $post_type = "audioes";//post type names 
    echo "djnbfj"; 
    $post_type->the_post(); 
    // The Query 
    $the_query = new WP_Query(array(
    'post_type' => $post_type, 
    'orderby' => 'post_date', 
    'order' => 'DESC', 
    'showposts' => 1, 
    )); 

    // The Loop 
    ?> 

    <?php 
    while ($the_query->have_posts()) : $the_query->the_post(); ?> 
    <div class="issue-content"> 
      <?php get_template_part('includes/breadcrumbs', 'page'); ?> 
      <?php if (has_post_thumbnail()) { the_post_thumbnail();} 
      get_template_part('loop-audio', 'page'); 
      ?> 
    </div><!--issue-content--> 
    <?php endwhile; ?> 

</div> <!-- end #left_area --> 

위의 사용자 정의 게시물 유형을 어떻게 얻을 수 있습니까?

답변

0

게시물 유형이 "오디오"또는 "오디오"입니까? $ post_type 변수는 "audioes"로 설정됩니다.

+0

내 게시물 유형 "오디오". – Ranjit

0

라인이 get_template_part이거나 echo 라인이 무엇인지 잘 모르겠지만 아래 코드는 게시물 유형을 표시해야합니다. 또한 코드에 "오디오"라는 게시물 유형 이름이 있지만 이름이 "오디오"라고 명시해야합니다. 아래 코드를 사용해보십시오. 그러나 포스트 유형의 이름이 "audioes"인 경우 아래 코드에서 해당 게시물 유형을 변경해야합니다. <?php the_post_thumbnail(); ?><?php the_content(); ?> 주위에 div, span 또는 다른 HTML 태그를 추가하여 원하는 CSS 스타일을 제공 할 수 있습니다.

<?php query_posts(array('post_type' => 'audio', 'posts_per_page' => 1, 'orderby' => 'post_date', 'order' => 'DESC')); ?> 
<?php while (have_posts()) : the_post(); ?> 

<div class="issue-content"> 

    <?php the_post_thumbnail(); ?> 

    <?php the_content(); ?> 

</div> 

<?php endwhile; wp_reset_query(); ?> 
관련 문제