Skip to content

Instantly share code, notes, and snippets.

@pigmentGit
Created February 23, 2015 12:52
Show Gist options
  • Save pigmentGit/9bcad1c3830213c19e51 to your computer and use it in GitHub Desktop.
Save pigmentGit/9bcad1c3830213c19e51 to your computer and use it in GitHub Desktop.
Pagination custom post types custom page template
<!-- Loop -->
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args= array(
'post_type' => 'aktuellt',
'posts_per_page' => 3,
'paged' => $paged,
);
query_posts($args); while ( have_posts() ) : the_post(); ?>
<article class="blog">
<small class="date"><?php the_date(); ?> </small>
<a href="<?php the_permalink(); ?> "><h2><?php the_title();?> </h2></a>
<p><?php echo get_excerpt(500); ?></p>
<?php echo sharing_display(); ?>
<ul class="categories"><?php foreach((get_the_category()) as $category) { echo " <li class='$category->cat_name'> ". $category->cat_name . " </li>";}?></ul>
</article>
<?php
endwhile;?>
<!-- Bläddra sidor -->
<div class="pagination"><?php echo paginate_links( $args ); ?></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment