2012-03-08 2 views
0

좋아, 내 블로그에만 동영상을 게시하는 동영상이라는 맞춤 게시물 유형이 있습니다. 왼쪽 비디오, 그리고 비디오에서 날짜와 시간, 카테고리 및 태그가에 오른쪽에맞춤 카테고리가 잘못된 카테고리 및 태그를 가져 오는 중

enter image description here

아래 sceen 캡은 사용자 정의 포스트 유형의 최신 포스트가있다입니다. 하지만 문제는 태그, 카테고리, 날짜가 잘못되었습니다. 어떻게 해결할 수 있습니까? 글로벌 $post 변수를 덮어

$queryObject->the_post(); 

: 여기

내가 문제가 다운이 호출에 대한 생각

<?php 
/* 
Template Name: Single Videos 
*/ 
?> 
<?php get_header() ?> 

<div id="wrapper"> 

<div id="container"> 

<div id="contentfull"> 



    <?php the_post() ?> 

     <div class="entry-wide"> 
      <center><h2 class="page-title2"><?php the_title() ?></h2>  </center> 

      <div class="entry-videoo"> 
<?php the_content() ?> 



<?php wp_link_pages('before=<div class="page-link">' . __('Pages:', 'wpbx') . '&after=</div>') ?> 


      </div> 

<div id="videosidebar"> 

<?php 
$queryObject = new WP_Query('post_type=videos&posts_per_page=2020&orderby=rand'); 
// The Loop! 
if ($queryObject->have_posts()) { 
?> 

<?php 
while ($queryObject->have_posts()) { 
    $queryObject->the_post(); 

    ?> 

<table width="100%" border="0" cellspacing="0" cellpadding="0"> 

<tbody> 

<tr> 

<td valign="top" width="1%"> 
<div id="videoimg"><a href="<?php the_permalink(); ?>" title="<?php printf(__('Read %s', 'wpbx'), wp_specialchars(get_the_title(), 1)) ?>"> 
        <?php the_post_thumbnail('video-post'); ?> 
        </a></div> 
</td> 

<td valign="top" width="90%"> 
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
</td> 

</tr> 


</table> 
<?php 
} 
?> 
<?php 
} 
?> 
</div> 

<div class="entry-info"> 

<div class="entry-meta-top"> 
        <span class="entry-date"><font color="#e60288"><b><?php the_time(__('F jS, Y', 'kubrick')) ?></b></font></span> 
        <span class="entry-meta-sep">|</span> 
        <span class="entry-cat">Published in: <?php the_category(', '); ?> </span> 


<div id="sharing"> 
<span class='st_facebook_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'></span><span class='st_twitter_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'></span><span class='st_plusone_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'></span></div> 
      </div> 

<br> 
<?php the_tags(__('<span class="tag-links"><strong>More On:</strong> ', 'wpbx'), ", ", "</span>\n") ?> 


<div class="entry-content"> 
        <?php the_excerpt(); ?> 
       </div> 


</div> 

<div class="entry-commm"> 

<?php comments_template(); ?></div> 


     </div><!-- entry --> 





</div><!-- #contentfull --> 
</div><!-- #container --> 
</div><!-- #wrapper --> 

<?php get_footer() ?> 

답변

0

아래에 해당 템플릿 페이지의 코드입니다. 나중에 전화 할 때 (예 : the_title()) 해당 루프의 값을 사용하며 맞춤 게시물 자체는 사용하지 않습니다. $queryObject 루프 후 PHP 코드에서

wp_reset_postdata() 

를 추가하십시오 (즉, <div class="entry-info"> 전).

작은 글자 - tbody 태그를 닫지 않아야합니다. 생성 된 HTML을 the w3c validator을 통해 실행하고 문제를 수정하십시오. 앞으로 발생할 수있는 CSS 문제를 해결하는 데 도움이됩니다.

관련 문제