0

I am trying to add a line or two of code to what I am using to call posts to my archive pages.

I've tried a lot of things, but because I'm using a piece of code that is a little irregular, everything I enter has not worked (it doesn't match up with the code in question in previous answers on here).

Here is the code I'm using. I just want to be able to set the number of posts per page(and, if possible, add a "next page" button).

    <?php if( $posts ) : ?>
    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    <?php $column = ($column == '') ? 'first' : (($column == 'first') ? 'middle' : (($column == 'middle') ? 'last' : 'first' )); ?>
    <div class="post <?php echo $column; ?>" id="post-<?php the_ID(); ?>" >
        <div style="border-bottom:1px solid #DDD; border-radius:5px; padding:3px; margin-bottom:20px;">
            <a href="<?php echo get_permalink($post->ID); ?>" >
                <?php if ( has_post_thumbnail()) : the_post_thumbnail('columner-thumb'); endif; ?>
                <h3><?php echo $post->post_title; ?></h3>
            </a>
                <p><?php the_excerpt(); ?> </p>
            <h5><i>Published <?php the_time('F j, Y'); ?> in </i><?php the_category(' ');?></h5>
        </div>
    </div>

  <?php endforeach; ?>
  <?php endif; ?>
4
  • 1
    Are you trying to do it independently from the global loop count? Because you can change the count from settings > read
    – marcovega
    Commented Jul 4, 2015 at 19:55
  • Did you tried this? /wp-admin/options-reading.php > Blog pages show at most Commented Jul 4, 2015 at 20:35
  • I suggest you take a look at how the archives are coded in the default themes and use that method. You can use 2 CSS declarations to display your posts in columns. Commented Jul 5, 2015 at 0:15
  • Use a normal paged code [wordpress.stackexchange.com/questions/123150/… here is a solution, also you can use a pagination plugin. Commented Jul 5, 2015 at 1:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.