wblake37 Posted September 16, 2011 Share Posted September 16, 2011 Im still new to php and was looking for some help with this code, it displays random posts with images, what i want is related posts by "tags" or "categories" Its for wordpress. original code: <?php $recent = new WP_Query("cat=<? echo $tg_video_post; ?>&showposts=5&orderby=rand"); while($recent->have_posts()) : $recent->the_post();?> <div class="singleright"> <div class="singlerightimage"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><img src="<?php $values = get_post_custom_values("thumb"); echo $values[0]; ?>" width="90" height="54" alt="<?php the_title_attribute(); ?>" /></a> </div> <div class="singlerighti"> <div class="singlerightinfo"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php $tit = the_title('','',FALSE); echo substr($tit, 0, 50); if (strlen($tit) > 50) echo " ..."; ?></a> </div> <div class="postviews"> <?php the_time('F jS, Y') ?> </div> <div class="postviews"> <?php if(function_exists('the_views')) { the_views(); } ?> </div> </div> </div> <?php endwhile; ?> Any help is greatly appreciated Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.