php - How do I centre post navigation links with images in WordPress? -


i'm building own wordpress theme , struggling post navigation looking right.

i have 2 images (a 'left/older' arrow , 'right/newer' arrow) want represent links show older or newer posts respectively. links displayed beneath last post shown.

if there no newer posts (i.e. we're on front page) want show 'older' arrow link should centred, if both newer , older posts available want show both arrows, again centred @ bottom of page. finally, if there no older (i.e. newer posts) available want show 'newer' posts arrow centred.

here's image illustrate:

desired arrangement of post navigation links

i've read docs on posts_nav_links() can't seem right.

can me out?

try this...

<?php global $wp_query; if ( $wp_query->max_num_pages > 1 ) : ?> <div align="center">   <div class="previous">     <?php next_posts_link( '<img src="older post arrow" />' ); ?>   </div>   <div class="next">     <?php previous_posts_link( '<img src="newer post arrow" />' ); ?>   </div> </div> <?php endif;?> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -