Published on Aug 14, 2018

How to add links to Previous and Next Posts in Oxygen

Sridhar Katakam

Updated on October 15, 2020

This tutorial provides the steps to add previous and next post links on single post pages in Oxygen.

Step 1

Edit your Oxygen template for single blog posts.

Step 2

Add a Section where you want the previous and next post links to appear.

Add a Columns element with 50 50 column layout.

Add a Code Block element in the left column having:

<?php
if ( get_previous_post_link() ) {
previous_post_link();
}
?>

Add a Code Block element in the right column having:

<?php
if ( get_next_post_link() ) {
next_post_link();
}
?>

Select the right column div and set Right horizontal item alignment.

Update: How to show previous and next posts in the same category as the current post

In Step 2 above change

<?php
if ( get_previous_post_link() ) {
previous_post_link();
}
?>

to

<?php
if ( get_previous_post_link() ) {
previous_post_link( '&laquo; %link', '%title', true, '', 'category' );
}
?>

and

<?php
if ( get_next_post_link() ) {
next_post_link();
}
?>

to

<?php
if ( get_next_post_link() ) {
next_post_link( '&raquo; %link', '%title', true, '', 'category' );
}
?>

Reference: https://codex.wordpress.org/Function_Reference/previous_post_link

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-ocalendar-check-omagnifiercrossmenuchevron-downarrow-right