Advertisement
Guest User

category.php

a guest
Sep 25th, 2014
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.11 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Archives
  4. */
  5.  
  6. get_header();
  7.  
  8. function remove_sharedaddy(){
  9.  
  10.     // if sharing_display() function does not exist, return
  11.   if( ! function_exists( 'sharing_display' ) )
  12.     return;
  13.  
  14.     // remove the callback sharing_display() for the 'the_content' filter.
  15.  
  16.   remove_filter( 'the_content', 'sharing_display', 19 );
  17.  
  18. }
  19. ?>
  20.  
  21. <div class="intro">
  22. <h1><?php single_cat_title(); ?> Category Archives</h1>
  23. </div>
  24.  
  25. <div class="wrapper clearfix">
  26.   <div class="content" role="main">
  27.     <div class="sidebar-content">
  28.       <?php get_sidebar(); ?>
  29.     </div>
  30.     <div class="main-content">
  31.  
  32.       <?php
  33.       $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
  34.       $args=array(
  35.         'post_type' => 'post',
  36.         'post_status' => 'publish',
  37.         'paged' => $paged,
  38.         'caller_get_posts'=> 1
  39.         );
  40.  
  41.       $my_query = null;
  42.       $my_query = new WP_Query($args);
  43.       if( $my_query->have_posts() ) {
  44.         while ($my_query->have_posts()) : $my_query->the_post(); ?>
  45.         <?php
  46.         global $more;
  47.         $more = 0;
  48.         ?>
  49.         <h2 class="heading2 entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  50.         <div class="meta-box">
  51.           <?php echo get_avatar( get_the_author_meta('user_email'), $size = '30'); ?><p>By <?php the_author_link(); ?> on <?php the_date(); ?> </p>
  52.         </div>
  53.         <?php
  54.         the_post_thumbnail( 'full' );
  55.         remove_sharedaddy();
  56.         the_content(__('<br />Read More</div>'));
  57.         ?>
  58.         <?php
  59.         endwhile;
  60.     $big = 999999999; // need an unlikely integer
  61.     ?>
  62.     <div id="pagination">
  63.       <?php
  64.       echo paginate_links( array(
  65.         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
  66.         'format' => '?paged=%#%',
  67.         'current' => max( 1, get_query_var('paged') ),
  68.         'total' => $my_query->max_num_pages
  69.         ) );
  70.         ?>
  71.       </div>
  72.       <?php
  73.     }
  74. wp_reset_query();  // Restore global post data stomped by the_post().
  75. ?>
  76.  
  77. </div>
  78. </div>
  79. </div>
  80. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement