ashbryant

Custom post type issues

Sep 30th, 2011
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.36 KB | None | 0 0
  1. <?php $loop = new WP_Query( array( 'post_type' => 'case_studies', 'posts_per_page' => 10 ) ); ?>
  2.  
  3. <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  4.  
  5.     <article>
  6.    
  7.         <h2><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Continue reading about %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  8.        
  9.         <?php // set the title for the post thumbnail image
  10.                 $default_attr = array(
  11.                                     'title' => trim(strip_tags( $attachment->post_title )),
  12.                                     );
  13.            
  14.             if(has_post_thumbnail()) { ?>
  15.            
  16.            
  17.                 <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Continue reading about %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" class="post-thumnail">
  18.                     <?php the_post_thumbnail( array( 210, 140, true ), $default_attr); ?>
  19.                 </a>
  20.         <?php } ?>
  21.                        
  22.         <?php the_excerpt(); ?>
  23.        
  24.         <p><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Continue reading about %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php printf( esc_attr__( 'Read more about %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?></a></p>
  25.        
  26.                
  27.     </article>
  28.     <?php endwhile; ?>
  29.  
  30.     <?php rewind_posts(); wp_reset_query(); ?> 
  31.  
  32.     </section>
  33.    
  34.     <section id="sidebar">
  35.     <?php get_sidebar(); ?>
  36.     </section>
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment