Jpetracca
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Hacks
In reply to: Trouble with my loop: how to get next posts and previous posts workingTried out your solution @alchymyth.. came up with the following code… however, it didn’t work. Added a ‘next’ link in the loop but when clicked it brings to /page/2/ but the content is the same.
Here’s the new code:
<div class="col-md-8"> <?php $page = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 ?> <?php $my_query = new WP_Query( array( 'cat=1&page=' . $page) ) ?> <?php 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="https://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="https://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; ?> <h4><?php previous_posts_link( 'prev', $my_query->max_num_pages ); next_posts_link( 'next', $my_query->max_num_pages ); ?></h4> <?php wp_reset_postdata(); ?> <?php else : ?> <h4>The Stuff You're Looking For Is Not Here!</h4> <?php endif; ?> </div>
Thanks for all the help guys! If anyone sees the issue please let me know… struggling with it here… ??
Forum: Hacks
In reply to: Trouble with my loop: how to get next posts and previous posts working@bcworkz – Yes I’ve tried that variation.. been through the codex looking for possible fixes but no luck yet as to why it’s not showing up.
Thanks for the insight – please let me know if you think of anything else !
Viewing 2 replies - 1 through 2 (of 2 total)