Guest User

wordpress foreach loop

a guest
Jun 18th, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php $taxonomies = get_object_taxonomies( (object) array( 'post_type' => 'psykolog' ) );
  2.        
  3.         foreach( $taxonomies as $taxonomy ) :
  4.  
  5.     // Gets every "category" (term) in this taxonomy to get the respective posts
  6.     $terms = get_terms( $taxonomy );
  7.    
  8.         foreach ( $terms as $term) :
  9.            
  10.             echo $term->name;
  11.             query_posts(array('afdelinger' => $term->name, 'post_type'=>'psykolog'));
  12.             if ( have_posts() ) : while ( have_posts() ) : the_post(); // The loop ?>
  13.             <?php echo $termname; ?>
  14.              <h1 class="entry-title"><?php the_title(); ?></h1>
  15.              <a href="<?php the_permalink()?>">test</a>
  16.              <? $images = get_post_meta($post->ID, 'profilbilled', true);?>
  17.              <img id="profile-image" src="<?php echo $images[0]['image']; ?>" alt="<?php echo esc_attr($images[0]['title']); ?>" />
  18.              <?php
  19.             endwhile;
  20.              wp_reset_query();
  21.             endif;
  22.             endforeach;
  23.     endforeach;
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment