<?php
//for in the loop, display all "content", regardless of post_type,
//that have the same custom taxonomy (e.g. genre) terms as the current post (pick cat)
$backup = $post; // backup the current object
$found_none = '';
$taxonomy = 'kund';// e.g. post_tag, category, custom taxonomy
$param_type = 'kund'; // e.g. tag__in, category__in, but genre__in will NOT work
$post_types = get_post_types( array('public' => true), 'names' );
$tax_args=array('orderby' => 'none');
$tags = wp_get_post_terms( $post->ID , $taxonomy, $tax_args);
if ($tags) {
foreach ($tags as $tag) {
$args=array(
"$param_type" => $tag->slug,
'post__not_in' => array($post->ID),
'post_type' => $post_types,
'showposts'=>-1,
'cat' => 5,
'caller_get_posts'=>1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) { ?>
<div id="wrapper-extra" class="container_24">
<div class="thumbnails">
<div class="grid_24"><h3 class="liten-rubrik"></h3></div>
<?php while ($my_query->have_posts()) :?>
<?php $my_query->the_post(); ?>
<div class="newsbox grid_8">
<div class="news-thumbnail">
<a class="news-thumbnail" href="<?php the_permalink() ?>" rel="<?php the_ID(); ?>" title="Nyhet - <?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?></a>
</div>
<div class="news-description">
<a class="news-link" href="<?php the_permalink() ?>" rel="<?php the_ID(); ?>" title="Nyhet - <?php the_title_attribute(); ?>">
<?php the_title('<p class="news-titel">', '</p>'); ?>
<div class="news-excerpt"><?php the_excerpt(); ?></div>
<p class="news-date"><?php the_time('F j, Y'); ?></p>
</a>
</div>
<div class="mobile-title"><?php the_title('<p class="mobile-news-titel">', '</p>'); ?></div>
</div> <!-- end newsbox grid_8 -->
<?php $found_none = '';
endwhile;
}
}
}
if ($found_none) {
echo $found_none;
}
$post = $backup; // copy it back
wp_reset_query(); // to use the original query again
?>