Custom related posts with thumbnails
-
Hey everybody.
I have a blog that hosts only videos and I want to relate them to each other via tags.
So there is this section that pulls thumbnails from attached images of another post in order to offer up other clips which looks like this:<?php $my_query = new WP_Query('tag__in=tag3&orderby=rand&cat=6&showposts=3'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); if( $post->ID == $current ) continue; ?> <a href="<?php the_permalink(); ?>"><?php $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $post->ID ); $firstImageSrc = wp_get_attachment_image_src(array_shift(array_keys($images))); echo "<img src=\"{$firstImageSrc[0]}\" width=\"50\" height=\"50\" />"; ?></a> <?php endwhile;?>
Now at the moment the tag is ‘tag3’ which was a test tag and doesn’t actually exist anymore. The function runs nevertheless but the pattern is neither random nor can I deduce any logic from it.
What I would love to do is to put all the posttags in an array and pass that on to the ‘tag__in’, but I’m not sure if that can even read multiple tags, and my PHP basics are pretty bad so I’ve been playing with it rather unsuccessfully even after googling my way around on how to pass arrays or checking out the parameter s in the codex.
Any help would be greatly appreciated.
Thanks,
Czymra
- The topic ‘Custom related posts with thumbnails’ is closed to new replies.