Advertisement
Fritex

Wordpress 9 posts from category (2 sections) with pagination

Jul 24th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.49 KB | None | 0 0
  1. <div class="main-split-left">
  2. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
  3. <?php $my_query = new WP_Query('category_name='.$category_name.'&posts_per_page=5&paged='.$paged); ?>
  4. <?php while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[] = $post->ID; ?>
  5.     <article class="article-big-block">
  6.         <div class="article-photo">
  7.             <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><span class="shadow"><?php the_post_thumbnail('a-b-bl-thumb'); ?></span></a>
  8.         </div>
  9.        
  10.         <header class="article-header">
  11.             <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo ShortenText3(get_the_title()); ?></a></h2>
  12.         </header>
  13.    
  14.         <div class="article-content">
  15.             <p class="pabbfpb"><i class="icon-time ictabbf"></i> <time itemprop="datePublished" content="<?php the_time('Y-F-j'); ?>"><?php the_time('j. F'); ?></time> u <span><?php the_time('H:i'); ?></span> | <span>Piše: <a rel="author" href="<?php echo $author_link; ?>" title="View all posts from author <?php echo $author; ?>" class="article-icon-link"><?php echo $author; ?></a></span></p>
  16.             <p><?php echo ShortenExcerpt(get_the_content()); ?></p>
  17.         </div>
  18.        
  19.         <div class="article-links">
  20.             <a href="<?php the_permalink(); ?>#comments" title="View Comments for article <?php the_title(); ?>" class="article-icon-link"><i class="icon-comments"></i> <?php comments_number( 'No Comments', 'One Comment', '% Comments' ); ?></a><meta itemprop="interactionCount" content="UserComments:<?php comments_number( '0', '1', '%' ); ?>"> <a href="<?php the_permalink(); ?>" title="Read article <?php the_title(); ?>" class="article-icon-link"><i class="icon-file-text-alt"></i> Read Full Article</a>
  21.         </div>
  22.  
  23.     </article>
  24.                
  25. <?php wp_reset_query(); endwhile; ?>
  26.                
  27. </div>
  28.        
  29. <div class="main-split-right">
  30. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
  31. <?php query_posts(array('category_name'=>$category_name,'post__not_in'=>$do_not_duplicate,'posts_per_page'=>'4', 'paged'=>$paged)); ?>
  32. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  33.     <article class="article-small-block">
  34.         <header class="article-header">
  35.             <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo ShortenText3(get_the_title()); ?></a></h2>
  36.         </header>
  37.                
  38.         <div class="article-photo">
  39.             <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><span class="shadow"><?php the_post_thumbnail('a-s-bl-thumb'); ?></span></a>
  40.         </div>
  41.                
  42.         <div class="article-content">
  43.             <p><?php echo ShortenExcerpt2(get_the_content()); ?></p>
  44.         </div>
  45.                
  46.         <div class="article-links">
  47.             <a href="<?php the_permalink(); ?>#comments" title="View Comments for article <?php the_title(); ?>" class="article-icon-link"><i class="icon-comments"></i> <?php comments_number( 'No Comments', 'One Comment', '% Comments' ); ?></a><meta itemprop="interactionCount" content="UserComments:<?php comments_number( '0', '1', '%' ); ?>"> <a href="<?php the_permalink(); ?>" title="Read article <?php the_title(); ?>" class="article-icon-link"><i class="icon-file-text-alt"></i> Read Full Article</a>
  48.         </div>
  49.     </article>
  50.            
  51. <?php wp_reset_query(); endwhile; endif; ?>
  52.            
  53. </div>
  54.        
  55. <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
  56.     <?php next_posts_link('Next Page &raquo;') ?>
  57.     <?php previous_posts_link('&laquo; Previous Page') ?>
  58. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement