New Paste

 

Recent Pastes

Administrate




PageLines PasteBin.

PasteID: 3y4
Pasted by Anonymous, 2012-10-04 20:19:17 GMT
Expires Never
Paste size 491 b
Toggle Expand   Wrap   Raw
Copy Contents   Copy URL
 
  1. 	$qf = new WP_Query( array( 
  2. 		'post_type'	=> $this->post_type_id,
  3. 		'orderby'	=> 'rand',
  4. 		'showposts'	=> -1
  5. 		 ) );		
  6. if ( isset( $qf->posts ) ){
  7. 	$c = 0;
  8. 	foreach ( $qf->posts as $key => $p ) {
  9. 		$f = false;
  10. 		$term = false;
  11.  
  12. 		$t = get_the_terms( $p->ID, 'showcase-genres' );
  13.  
  14. 		foreach( $t as $term ) {
  15. 			if( $term->slug == 'featured-themes' )
  16. 				$f = true;
  17. 		}
  18. 		if ( false === $f || $c > 8) {
  19.  
  20. 			unset( $qf->posts[$key] );
  21. 		}
  22. 		$c++;
  23. 	}	
  24. }
 
 
 

 
 
 
 
 
Written by Xan Manning, 2010.
YOU NEED FLASH!