Skip to content

Instantly share code, notes, and snippets.

@ericjames
Created July 1, 2017 21:08
Show Gist options
  • Save ericjames/70b34a69b86c87c0f65eea887a3baf0f to your computer and use it in GitHub Desktop.
Save ericjames/70b34a69b86c87c0f65eea887a3baf0f to your computer and use it in GitHub Desktop.
Wordpress Table of Contents
<ul>
<?php global $query_string;
query_posts ( $query_string . '&posts_per_page=5&offset=0'); ?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="#post-<?php the_ID(); ?>" title="Read <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br />
<span><?php the_time('n/j/y')?></span> - <span><?php the_author() ?></span> - <?php the_tags( '<span>', ', ', '</span>'); ?>
</li>
<?php endwhile; ?>
</ul>
<ul>
<?php global $query_string;
query_posts ( $query_string . '&posts_per_page=5&offset=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="#post-<?php the_ID(); ?>" title="Read <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br />
<span><?php the_time('n/j/y')?></span> - <span><?php the_author() ?></span> - <?php the_tags( '<span>', ', ', '</span>'); ?>
</li>
<?php endwhile; wp_reset_query(); ?>
</ul>
<?php if(class_exists('wp_pagination_plugin')){
$p = new wp_pagination_plugin;
$p->nextIcon('&rarr;'); // changing the icon 'next'
$p->prevIcon('&larr;'); // changing the previous 'icon'
$p->show();
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment