Advertisement
cellbits

myloop

Nov 3rd, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.50 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Test
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7.  
  8.  
  9.         <article>
  10.         <?php
  11.         $temp = $wp_query; $wp_query= null;
  12.         $wp_query = new WP_Query(); $wp_query->query('showposts=5' . '&paged='.$paged);
  13.         while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
  14.  
  15. <div class='articles'>
  16.  
  17.     <div class='one-post'>
  18.        
  19.           <?php global $more; $more = 0; ?>
  20.            
  21.             <div class='post-body'>
  22.  
  23.             <?php // Post featured image
  24.                 if(has_post_thumbnail())  {
  25.                
  26.                     if (!is_single()){ ?><a href="<?php the_permalink(); ?>" title="<?php printf( $SMTheme->_( 'permalink' ), the_title_attribute( 'echo=0' ) ); ?>"> <?php }
  27.                    
  28.                     the_post_thumbnail(
  29.                         array($SMTheme->get( 'layout', 'imgwidth' ), $SMTheme->get( 'layout', 'imgheight' )),
  30.                         array("class" => $SMTheme->get( 'layout','imgpos' ) . " featured_image")
  31.                     );
  32.                    
  33.                     if (!is_single()){ ?></a><?php }
  34.                    
  35.                 }
  36.  
  37.             ?>
  38.           <div id="post-<?php the_ID(); ?>" <?php post_class("post-caption"); ?>>
  39.            
  40.            
  41.            
  42.             <?php  //Title
  43.             if (!is_single()&&!is_page()) { ?>
  44.                 <h2><a href="<?php the_permalink(); ?>" title="<?php printf( $SMTheme->_( 'permalink' ), the_title_attribute( 'echo=0' ) ); ?>" class='post_ttl'><?php the_title(); ?></a></h2>
  45.             <?php } else { ?>
  46.                 <h1><?php the_title(); ?></h1>
  47.  
  48.             <?php }
  49.            
  50.  
  51.  
  52.             //Post meta (comments, date, categories)
  53.             if (!is_page()) {?><p class='post-meta'>
  54.            
  55.                 <span class='post-date'><?php echo get_the_date(); ?></span>
  56.                
  57.                 Posted in &nbsp;<?php the_category(', ');
  58.                
  59.                 edit_post_link( $SMTheme->_( 'edit' ), '     |     <span class="edit-link">', '</span>' );
  60.                
  61.                 if(comments_open( get_the_ID() ))  {
  62.                     ?>&nbsp;<span class='post-comments'><?php comments_popup_link( $SMTheme->_( 'noresponses' ), $SMTheme->_( 'oneresponse' ), $SMTheme->_( 'multiresponse' ) ); ?></span>
  63.                 <?php } ?>
  64.                
  65.             </p><?php } ?>
  66.            
  67.             </div>
  68.  
  69.                 <?php
  70.                 //Post content
  71.                 if (!is_single()&&!is_page()) {
  72.                     if ( ! post_password_required() ) { the_content(''); } else the_content('');
  73.                     ?><a href='<?php the_permalink(); ?>' class='readmore'><?php echo $SMTheme->_( 'readmore' ); ?></a><?php
  74.                 } else {
  75.                     the_content('');
  76.                 }
  77.                 wp_link_pages(); ?>
  78.         </div>
  79.     </div>
  80. </div>
  81.  
  82.         <?php endwhile; ?>
  83. <?php get_template_part('navigation'); ?>
  84.                 <?php if ($paged > 1) { ?>
  85.  
  86.         <?php } ?>
  87.  
  88.         <?php wp_reset_postdata(); ?>
  89.  
  90.     </article>
  91.  
  92. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement