-
-
Save pippinsplugins/3553850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jc_paged_posts_columns() { | |
echo '<div id="paged-columns">'; | |
global $post; | |
$numposts = 11; | |
$args = array( 'numberposts' => $numposts, 'offset' => 10 ); | |
$column1 = get_posts( $args ); | |
echo '<ul class="column-list">'; | |
echo '<li class="column-heading">Page 2</li><ol>'; | |
foreach ( $column1 as $post ) : setup_postdata($post); ?> | |
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> | |
<?php endforeach; wp_reset_postdata(); | |
echo '</ol></ul>'; | |
$args = array( 'numberposts' => $numposts, 'offset' => 21 ); | |
$column2 = get_posts( $args ); | |
echo '<ul class="column-list">'; | |
echo '<li class="column-heading">Page 3</li><ol>'; | |
foreach ( $column2 as $post ) : setup_postdata($post); ?> | |
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> | |
<?php endforeach; wp_reset_postdata(); | |
echo '</ol></ul>'; | |
$args = array( 'numberposts' => $numposts, 'offset' => 32 ); | |
$column3 = get_posts( $args ); | |
echo '<ul class="column-list">'; | |
echo '<li class="column-heading">Page 4</li><ol>'; | |
foreach ( $column3 as $post ) : setup_postdata($post); ?> | |
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> | |
<?php endforeach; wp_reset_postdata(); | |
echo '</ol></ul>'; | |
echo '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take a look at my forked version. You are missing wp_reset_postdata().
It's going to have problems when you change $numposts to something else. I would suggest that you auto calculate the offset based what $numposts is set to. You could actually set this up in a while() or for() loop pretty easily.