Guest User

Untitled

a guest
May 26th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1. <?php
  2.     $args = array('post_type' => 'portfolio');
  3.     $loop = new WP_Query($args);
  4.    
  5.     while ($loop->have_posts() ) : $loop->the_post();
  6.         $terms_projekttyp = wp_get_post_terms(get_the_ID(),'projekttyp');
  7.         $terms_tekniker = wp_get_post_terms(get_the_ID(),'tekniker');
  8.         $projekt_url = get_post_meta($post->ID,'link',true);
  9.         ?>
  10.         <article class="clearfix">
  11.             <a href="<?php the_permalink();?>"><?php the_post_thumbnail(); ?></a>
  12.             <div class="excerpt">
  13.                 <h3><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h3>
  14.                 <ul class="metadata">
  15.                 <?php
  16.  
  17.                     foreach ($terms_projekttyp as $projekttyp) {
  18.                         echo '<li>Projekttyp: <a href="'.get_term_link($projekttyp->slug, 'projekttyp').'">'.$projekttyp->name.'</a></li>';
  19.                     }
  20.  
  21.  
  22.                  ?>
  23.                  </ul>
  24.                  <!--<?php
  25.                     echo '<pre>'.print_r($terms_projekttyp).'</pre>';
  26.                     for ($i=0; $i < count($terms_projekttyp); $i++) {
  27.                         if ($i == 0) {
  28.                             echo '<li>Projekttyp: '.$terms_projekttyp[$i]->name.'</li>';   
  29.                         }
  30.                        
  31.                     }
  32.                 ?>-->
  33.                  <p>Tekniker:</p>
  34.                  <ul>
  35.                     <?php
  36.                         foreach ($terms_tekniker as $tekniker) {
  37.                             echo '<li>'.$tekniker->name.'</li>';
  38.                         }
  39.                     ?>
  40.                  </ul>
  41.                  <?php
  42.                     $content = get_the_content();
  43.                     if (!empty($content)) : ?>
  44.                  <a href="<?php the_permalink();?>">Lรคs mer</a> |<?php endif;?> <a href="<?php echo $projekt_url;?>" target="_blank"><?php echo $projekt_url;?></a>
  45.              </div>
  46.             </article>
  47.         <?php
  48.     endwhile;
  49. ?>
Add Comment
Please, Sign In to add comment