2012-03-08 53 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问题。

相关问题