Advertisement
Guest User

Untitled

a guest
Sep 5th, 2011
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.99 KB | None | 0 0
  1.     <div class="thumbnails container_24">  
  2.    
  3.    
  4.     <div class="grid_24">Portfolio</div>
  5.  
  6.                    
  7.     <?php
  8.     //for in the loop, display all "content", regardless of post_type,
  9.     //that have the same custom taxonomy (e.g. genre) terms as the current post
  10.     $backup = $post;  // backup the current object
  11.     $found_none = '';
  12.     $taxonomy = 'kund';//  e.g. post_tag, category, custom taxonomy
  13.     $param_type = 'kund'; //  e.g. tag__in, category__in, but genre__in will NOT work
  14.     $post_types = get_post_types( array('public' => true), 'names' );
  15.     $tax_args=array('orderby' => 'none');
  16.     $tags = wp_get_post_terms( $post->ID , $taxonomy, $tax_args);
  17.     if ($tags) {
  18.       foreach ($tags as $tag) {
  19.         $args=array(
  20.           "$param_type" => $tag->slug,
  21.           'post__not_in' => array($post->ID),
  22.           'post_type' => $post_types,
  23.           'showposts'=>-1,
  24.           'cat' => 45,
  25.           'caller_get_posts'=>1
  26.     );
  27.     $my_query = null;
  28.     $my_query = new WP_Query($args);
  29.     if( $my_query->have_posts() ) {
  30.       while ($my_query->have_posts()) : $my_query->the_post(); ?>
  31.         <div class="grid_8 newsbox post">
  32.             <div class="news-thumbnail">
  33.             <a class="news-thumbnail" href="<?php the_permalink() ?>" rel="<?php the_ID(); ?>" title="Nyhet - <?php the_title_attribute(); ?>">
  34.             <?php the_post_thumbnail(); ?></a>
  35.             </div>
  36.            
  37.             <div class="news-description">
  38.             <a class="news-link" href="<?php the_permalink() ?>" rel="<?php the_ID(); ?>" title="Nyhet - <?php the_title_attribute(); ?>">
  39.             <?php the_title('<p class="news-titel">', '</p>'); ?>
  40.             <div class="news-excerpt"><?php the_excerpt(); ?></div>
  41.             <p class="news-date"><?php the_time('F j, Y'); ?></p>  
  42.             </a>
  43.             </div>
  44.            
  45.             <div class="mobile-title"><?php the_title('<p class="mobile-news-titel">', '</p>'); ?></div>
  46.         </div> <!-- end grid_8 newsbox post -->        
  47.         <?php $found_none = '';
  48.         endwhile;
  49.         }
  50.       }
  51.     }
  52.     if ($found_none) {
  53.     echo $found_none;
  54.     }
  55.     $post = $backup;  // copy it back
  56.     wp_reset_query(); // to use the original query again
  57.     ?>
  58.    
  59.     <div class="grid_24">News</div>
  60.                    
  61.     <?php
  62.     //for in the loop, display all "content", regardless of post_type,
  63.     //that have the same custom taxonomy (e.g. genre) terms as the current post
  64.     $backup = $post;  // backup the current object
  65.     $found_none = '';
  66.     $taxonomy = 'kund';//  e.g. post_tag, category, custom taxonomy
  67.     $param_type = 'kund'; //  e.g. tag__in, category__in, but genre__in will NOT work
  68.     $post_types = get_post_types( array('public' => true), 'names' );
  69.     $tax_args=array('orderby' => 'none');
  70.     $tags = wp_get_post_terms( $post->ID , $taxonomy, $tax_args);
  71.     if ($tags) {
  72.       foreach ($tags as $tag) {
  73.         $args=array(
  74.           "$param_type" => $tag->slug,
  75.           'post__not_in' => array($post->ID),
  76.           'post_type' => $post_types,
  77.           'showposts'=>-1,
  78.           'cat' => 5,
  79.           'caller_get_posts'=>1
  80.     );
  81.     $my_query = null;
  82.     $my_query = new WP_Query($args);
  83.     if( $my_query->have_posts() ) {
  84.       while ($my_query->have_posts()) : $my_query->the_post(); ?>
  85.         <div class="grid_8 newsbox post">
  86.             <div class="news-thumbnail">
  87.             <a class="news-thumbnail" href="<?php the_permalink() ?>" rel="<?php the_ID(); ?>" title="Nyhet - <?php the_title_attribute(); ?>">
  88.             <?php the_post_thumbnail(); ?></a>
  89.             </div>
  90.            
  91.             <div class="news-description">
  92.             <a class="news-link" href="<?php the_permalink() ?>" rel="<?php the_ID(); ?>" title="Nyhet - <?php the_title_attribute(); ?>">
  93.             <?php the_title('<p class="news-titel">', '</p>'); ?>
  94.             <div class="news-excerpt"><?php the_excerpt(); ?></div>
  95.             <p class="news-date"><?php the_time('F j, Y'); ?></p>  
  96.             </a>
  97.             </div>
  98.            
  99.             <div class="mobile-title"><?php the_title('<p class="mobile-news-titel">', '</p>'); ?></div>
  100.         </div> <!-- end grid_8 newsbox post -->        
  101.         <?php $found_none = '';
  102.         endwhile;
  103.         }
  104.       }
  105.     }
  106.     if ($found_none) {
  107.     echo $found_none;
  108.     }
  109.     $post = $backup;  // copy it back
  110.     wp_reset_query(); // to use the original query again
  111.     ?>
  112.    
  113.    
  114.     </div> <!-- end thumbnail area -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement