Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wp_corenavi() {
- global $wp_query, $wp_rewrite;
- $pages = '';
- $max = $wp_query->max_num_pages;
- if (!$current = get_query_var('paged')) $current = 1;
- $a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999));
- $a['total'] = $max;
- $a['current'] = $current;
- $total = 1; //1 - display the text "Page N of N", 0 - not display
- $a['mid_size'] = 5; //how many links to show on the left and right of the current
- $a['end_size'] = 1; //how many links to show in the beginning and end
- $a['prev_text'] = '« Previous'; //text of the "Previous page" link
- $a['next_text'] = 'Next »'; //text of the "Next page" link
- if ($max > 1) echo '<div class="navigation">';
- if ($total == 1 && $max > 1) $pages = '<span class="pages">Page ' . $current . ' of ' . $max . '</span>'."rn";
- echo $pages . paginate_links($a);
- if ($max > 1) echo '</div>';
- }
- <?php
- get_header();
- if ( have_posts() ) : ?>
- <div id="container">
- <div id="content" role="main">
- <?php query_posts( 'category_name=category&showposts=2'); ?>
- <?php while ( have_posts() ) : the_post(); ?>
- <div>
- <div>
- <div class="thumb">
- <?php the_post_thumbnail('thumbnail'); ?>
- </div>
- <h2 class="entry-title" style="text-align:center;"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
- <div class="the-excerpt">
- <?php echo content(15, __('(Read More)')); /* twentyten_posted_on(); */ ?>
- </div><!-- .entry-meta -->
- </div>
- </div>
- <?php endwhile; // end of the loop. ?>
- <br clear="all" />
- <?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>
- </div><!-- #content -->
- </div><!-- #container -->
- <?php endif; ?>
- query_posts( 'category_name=category&showposts=2');
- $page = get_query_var('paged');
- $page = (!empty($page) ? $page : 1);
- query_posts( 'category_name=category&showposts=2&paged='.$page);
- <?php query_posts( 'category_name=category&showposts=2'); ?>
- <?php
- // Custom query args
- $category_query_args = array(
- 'category_name' => 'category'
- 'posts_per_page' => 2
- );
- // Custom query
- $category_query = new WP_Query( $category_query_args );
- // Reset pagination
- global $wp_query;
- $temp = $wp_query;
- $wp_query= null;
- $wp_query = $category_query;
- // Output the Loop
- if ( $category_query->have_posts() ) :
- ?>
- <div id="container">
- <div id="content" role="main">
- while ( $category_query->have_posts() ) : $category_query->the_post();
- ?>
- <div>
- <div>
- <div class="thumb">
- <?php the_post_thumbnail('thumbnail'); ?>
- </div>
- <h2 class="entry-title" style="text-align:center;"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
- <div class="the-excerpt">
- <?php echo content(15, __('(Read More)')); /* twentyten_posted_on(); */ ?>
- </div><!-- .entry-meta -->
- </div>
- </div>
- <?php
- endwhile;
- // Custom navigation
- ?>
- <br clear="all" />
- <?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>
- </div><!-- #content -->
- </div><!-- #container -->
- <?php
- endif;
- // Reset query
- $wp_query = null;
- $wp_query = $temp;
- wp_reset_query();
- ?>
- global $query_string;
- parse_str( $query_string, $my_query_array );
- $paged = ( isset( $my_query_array['paged'] ) && !empty( $my_query_array['paged'] ) ) ? $my_query_array['paged'] : 1;
- query_posts('post_type=post&posts_per_page=3&paged='.$paged);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement