Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="thumbnails container_24">
- <div class="grid_24">Portfolio</div>
- <?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
- $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' => 45,
- 'caller_get_posts'=>1
- );
- $my_query = null;
- $my_query = new WP_Query($args);
- if( $my_query->have_posts() ) {
- while ($my_query->have_posts()) : $my_query->the_post(); ?>
- <div class="grid_8 newsbox post">
- <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 grid_8 newsbox post -->
- <?php $found_none = '';
- endwhile;
- }
- }
- }
- if ($found_none) {
- echo $found_none;
- }
- $post = $backup; // copy it back
- wp_reset_query(); // to use the original query again
- ?>
- <div class="grid_24">News</div>
- <?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
- $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() ) {
- while ($my_query->have_posts()) : $my_query->the_post(); ?>
- <div class="grid_8 newsbox post">
- <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 grid_8 newsbox post -->
- <?php $found_none = '';
- endwhile;
- }
- }
- }
- if ($found_none) {
- echo $found_none;
- }
- $post = $backup; // copy it back
- wp_reset_query(); // to use the original query again
- ?>
- </div> <!-- end thumbnail area -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement