Advertisement
Guest User

Untitled

a guest
Mar 9th, 2017
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. function wp_corenavi() {
  2. global $wp_query, $wp_rewrite;
  3. $pages = '';
  4. $max = $wp_query->max_num_pages;
  5. if (!$current = get_query_var('paged')) $current = 1;
  6. $a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999));
  7. $a['total'] = $max;
  8. $a['current'] = $current;
  9.  
  10. $total = 1; //1 - display the text "Page N of N", 0 - not display
  11. $a['mid_size'] = 5; //how many links to show on the left and right of the current
  12. $a['end_size'] = 1; //how many links to show in the beginning and end
  13. $a['prev_text'] = '« Previous'; //text of the "Previous page" link
  14. $a['next_text'] = 'Next »'; //text of the "Next page" link
  15.  
  16. if ($max > 1) echo '<div class="navigation">';
  17. if ($total == 1 && $max > 1) $pages = '<span class="pages">Page ' . $current . ' of ' . $max . '</span>'."rn";
  18. echo $pages . paginate_links($a);
  19. if ($max > 1) echo '</div>';
  20. }
  21.  
  22. <?php
  23.  
  24. get_header();
  25.  
  26. if ( have_posts() ) : ?>
  27. <div id="container">
  28. <div id="content" role="main">
  29.  
  30. <?php query_posts( 'category_name=category&showposts=2'); ?>
  31. <?php while ( have_posts() ) : the_post(); ?>
  32.  
  33. <div>
  34. <div>
  35. <div class="thumb">
  36. <?php the_post_thumbnail('thumbnail'); ?>
  37. </div>
  38. <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>
  39. <div class="the-excerpt">
  40. <?php echo content(15, __('(Read More)')); /* twentyten_posted_on(); */ ?>
  41. </div><!-- .entry-meta -->
  42. </div>
  43. </div>
  44.  
  45. <?php endwhile; // end of the loop. ?>
  46. <br clear="all" />
  47. <?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>
  48. </div><!-- #content -->
  49. </div><!-- #container -->
  50. <?php endif; ?>
  51.  
  52. query_posts( 'category_name=category&showposts=2');
  53.  
  54. $page = get_query_var('paged');
  55. $page = (!empty($page) ? $page : 1);
  56. query_posts( 'category_name=category&showposts=2&paged='.$page);
  57.  
  58. <?php query_posts( 'category_name=category&showposts=2'); ?>
  59.  
  60. <?php
  61. // Custom query args
  62. $category_query_args = array(
  63. 'category_name' => 'category'
  64. 'posts_per_page' => 2
  65. );
  66. // Custom query
  67. $category_query = new WP_Query( $category_query_args );
  68.  
  69. // Reset pagination
  70. global $wp_query;
  71. $temp = $wp_query;
  72. $wp_query= null;
  73. $wp_query = $category_query;
  74.  
  75. // Output the Loop
  76. if ( $category_query->have_posts() ) :
  77. ?>
  78. <div id="container">
  79. <div id="content" role="main">
  80.  
  81. while ( $category_query->have_posts() ) : $category_query->the_post();
  82. ?>
  83. <div>
  84. <div>
  85. <div class="thumb">
  86. <?php the_post_thumbnail('thumbnail'); ?>
  87. </div>
  88. <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>
  89. <div class="the-excerpt">
  90. <?php echo content(15, __('(Read More)')); /* twentyten_posted_on(); */ ?>
  91. </div><!-- .entry-meta -->
  92. </div>
  93. </div>
  94. <?php
  95. endwhile;
  96.  
  97. // Custom navigation
  98. ?>
  99. <br clear="all" />
  100. <?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>
  101.  
  102. </div><!-- #content -->
  103. </div><!-- #container -->
  104.  
  105. <?php
  106. endif;
  107.  
  108. // Reset query
  109. $wp_query = null;
  110. $wp_query = $temp;
  111. wp_reset_query();
  112. ?>
  113.  
  114. global $query_string;
  115. parse_str( $query_string, $my_query_array );
  116. $paged = ( isset( $my_query_array['paged'] ) && !empty( $my_query_array['paged'] ) ) ? $my_query_array['paged'] : 1;
  117. query_posts('post_type=post&posts_per_page=3&paged='.$paged);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement