Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Jpetracca on "Trouble with my loop: how to get next posts and previous posts working"

$
0
0

I'm having trouble getting the loop to show next and previous posts on a page.php.
The loop is supposed to show 10 posts (I set it down to 2 to try it out..) and then the next/previous posts link on the bottom... leading to the older posts if there are more than 10, etc...

site/page: tobylavigne.com/guidnace

<div class="col-md-8">
                     <?php
  $my_query = new WP_Query( array( 'numberposts' => 5,) );
  if( $my_query->have_posts() ):
     while( $my_query->have_posts() ):
        $my_query->the_post(); ?>

            <div id="fademobile" class="col-md-5" style="margin-top:30px"><div><?php if ( has_post_thumbnail()) : ?>
   <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
   <?php the_post_thumbnail( array(999999, 250)); ?>
   </a>
 <?php endif; ?></div></div>
            <div id="onlymobile" class="col-md-5" style="margin-top:30px"><div><?php if ( has_post_thumbnail()) : ?>
   <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
   <?php the_post_thumbnail( array(220, 9999999)); ?>
   </a>
 <?php endif; ?></div></div>
            <div class="col-md-7 block1 blogcontent">
            <div class="col-md-3 col-md-offset-2">
                    <div class="blogposttitle"><h3 class="text-center" style="margin-top:1px; color:#fff; font-size:1.3em; padding-top:2px"><?php the_time('F'); ?></h3><h4 class="text-center" style=" color:#fff; font-size:1em"><?php the_time('j, Y'); ?></h4>
                        </div>
                    </div>
                    <div><br><br><br>
                        <a href="<?php the_permalink(); ?>"><h4 class="text-center"><? the_title(); ?></h4></a>
                        <p><?php the_excerpt(); ?></p>

                    <div class="fb-share-button" data-href="<?php the_permalink(); ?>" data-type="button" style="top:-5px"></div>
                        <a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo get_permalink(); ?>" data-count="none" data-text="Check out <?php the_title(); ?>" data-via="TobyLaVigne" >Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
                        <script src="//platform.linkedin.com/in.js" type="text/javascript"  >
 lang: en_US
</script>
<script type="IN/Share" data-url="<?php the_permalink(); ?>"></script>

                    </div>

                </div>
                <?php endwhile; ?>
                <div class="navigation"><p><?php posts_nav_link(); ?></p></div>

                    <?php else : ?>
                    <h4>The Stuff You're Looking For Is Not Here!</h4>
                  <?php endif; ?>
</div>

Please Help - I'm up for anything that works!


Viewing all articles
Browse latest Browse all 8245

Trending Articles