Advertisement
Guest User

WP Pagenavi com WP_Query

a guest
Sep 18th, 2011
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.52 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  <?php global $woo_options; ?>
  3.  
  4.  <div id="content" class="col-full">
  5.  <div id="main" class="col-left">
  6.  
  7.  <?php if ( function_exists( 'yoast_breadcrumb' ) ) { yoast_breadcrumb( '<div id="breadcrumb"><p>', '</p></div>' ); } ?>
  8.  
  9.  <?php
  10.  // Sub featured area
  11.  if ( $woo_options['woo_sub_featured'] == 'true' AND !is_paged() )
  12.  include ( TEMPLATEPATH . '/includes/sub-featured.php' );
  13.  ?>
  14.  
  15.  <div id="latest"<?php if ( $woo_options['woo_home_two_col'] == 'true' ) echo ' class="two-col"'; ?>>
  16.  
  17.  <h3 class="section"><?php _e( 'Matérias', 'woothemes' ); ?></h3>
  18.  <?php
  19.  // Exclude featured posts
  20.  global $shownposts;
  21.  if ( get_option( 'woo_exclude' ) != $shownposts AND !is_paged )
  22.  update_option( 'woo_exclude', $shownposts );
  23.  
  24.  if ( is_paged() )
  25.  $shownposts = get_option( 'woo_exclude' );
  26.  
  27.  $paged = (get_query_var( 'paged' )) ? get_query_var( 'paged' ) : 1;
  28.  $args = array(
  29.  'paged'=> $paged,
  30.  'post__not_in' => $shownposts
  31.  );
  32.  $home_list = WP_Query( $args ); //Pode utilizar o nome que preferir
  33.  ?>
  34.  
  35. <?php if ($home_list->have_posts()) : $count = 0; while ($home_list->have_posts()) : $home_list->the_post(); $count++; ?>
  36.  
  37.  <!-- Post Starts -->
  38.  <div <?php if ( $count == 2 ) { post_class('last'); $count = 0; } else { post_class(); } ?>>
  39.  
  40.  <?php if ( $woo_options['woo_post_content'] != "content" ) woo_image( 'width='.$woo_options['woo_thumb_w'].'&height='.$woo_options['woo_thumb_h'].'&class=thumbnail '.$woo_options['woo_thumb_align']); ?>
  41.  <?php woo_post_meta(); ?>
  42.  <h2 class="title">" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></h2>
  43.  
  44.  <div class="entry">
  45.  <?php global $more; $more = 0; ?>
  46.  <?php if ( $woo_options['woo_post_content'] == "content" ) the_content(__( 'Leia mais...', 'woothemes' )); else the_excerpt(); ?>
  47.  </div>
  48.  <div class="fix"></div>
  49.  
  50.  <div class="post-more">
  51.  <?php if ( $woo_options['woo_post_content'] == "excerpt" ) { ?>
  52.  <span class="read-more">" title="<?php _e( 'Leia matéria completa', 'woothemes' ); ?>"><?php _e( 'Leia mais...', 'woothemes' ); ?></span>
  53.  <?php } ?>
  54.  </div>
  55.  
  56.  </div><!-- /.post -->
  57.  
  58.  <?php endwhile; wp_reset_postdata(); else: ?>
  59.  <div class="post">
  60.  <p><?php _e( 'Desculpe, nenhum texto combina com seus critérios.', 'woothemes' ) ?></p>
  61.  </div><!-- /.post -->
  62.  <?php endif; ?>
  63.  
  64. <?php if(function_exists('wp_pagenavi')) : wp_pagenavi(array( 'query' => $home_list )); endif; ?>
  65.  
  66.  
  67.  
  68.  </div><!-- /#latest -->
  69.  </div><!-- /#main -->
  70.  
  71.  <?php get_sidebar(); ?>
  72.  
  73.  </div><!-- /#content -->
  74.  
  75. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement