2012-03-08 51 views
0

好吧我有一個自定義帖子類型在我的博客上被稱爲視頻,在那裏我只發佈視頻。有以下自定義帖子類型獲取錯誤的類別和標籤

enter image description here

一個sceen蓋在右側從自定義後類型的最新帖子,左邊是視頻,並在視頻下方的日期和時間,類別和標籤。 但問題是它出錯了,標籤,類別和日期。 我該如何解決這個問題?

這裏是模板頁面的下方

<?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

的代碼,我覺得你的問題是降低這一號召:

$queryObject->the_post(); 

覆蓋全球$post變量。您對(例如)the_title()的後續呼叫將使用該循環中的值,而不是自定義帖子本身。嘗試添加

wp_reset_postdata() 
在PHP代碼

$queryObject循環後(即<div class="entry-info">之前)。

還有一個小問題 - 你沒有關閉你的tbody標籤 - 通過the w3c validator運行生成的HTML並更正任何問題;它將有助於解決將來可能遇到的任何CSS問題。

相關問題