• I’m looking to shift my ‘previous post’ and ‘next post’ links to opposite sides of the page. Right now they sit on top of each other (see here), but I’d like the previous post link on the left side, and the next post link on the right.

    Here is my current code (in my single.php child theme):

    <div>
    <?php if (get_adjacent_post(false, '', true)): // if there are older posts ?>
    <span style='float: left;'><class="prev">Previous <?php previous_post_link('%link'); ?>
    <?php endif; ?>
    <?php if (get_adjacent_post(false, '', false)): // if there are newer posts ?>
    <span style='float: right;'><class="next">Next <?php next_post_link('%link'); ?>
    <?php endif; ?>
    </div>

    I thought adding <span style=’float: left;’> and <span style=’float: right;’> would do the trick, but it just stacked them. (Before I added that code, both links were on one line, flush to the right.)

    Any idea how to adjust the code so those links are spaced on opposite sides of the page?

Viewing 1 replies (of 1 total)
  • I would try adding width: 50%; to each and also text-align right to the .next.

    I would also add that to the stylesheet instead, but if you prefer to use inline styles… ??

Viewing 1 replies (of 1 total)
  • The topic ‘how to adjust the positions of 'previous post' and 'next post' links’ is closed to new replies.