wordpress - Custom post type getting wrong categories and tags -


ok have custom post type on blog called videos, post video. there's sceen cap below

enter image description here

on right latest post custom post type, on left video, , under video date , time, category , tags. problem is getting wrong, tags, categories, , date. how fix this?

here code of template page below

<?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' );  // 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() ?> 

i think issue down call:

$queryobject->the_post(); 

overwriting global $post variable. subsequent calls (e.g.) the_title() use values loop, not custom post itself. try adding

wp_reset_postdata() 

in php code after $queryobject loop (i.e. before <div class="entry-info">).

and minor thing - you're not closing tbody tag - run generated html through the w3c validator , correct issues; it'll resolve css issues may hit in future.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -