WordPress Oxygen Theme Recent Posts Slider

By | January 10, 2015

How to Set Up the WordPress Oxygen Theme Recent Posts Slider

Oxygen is a nice wordpress theme, but setting up the static front page slider can be a bit of a pain.

In this post find out how to show recent posts in the Oxygen theme slider.

Make sure you are using a child theme

We’re going to need to change some of the theme files. The safest way to do this is to use a ‘child theme’. This is an easy and safe way to personalise our theme.

If you’re not sure how to set up a child theme in wordpress, check out this guide here.

Set the Slider to Show Recent Posts

Once you’ve got your child theme sorted we can start editing the theme files.

To personalise the slider behaviour copy accross the file “featured-content.php” from the Oxygen folder to your child theme folder.

In this child version find the line:

$args = array( 'posts_per_page' => 6, 'meta_key' => '_oxygen_post_location', 'meta_value' => 'featured', 'post__not_in' => get_option( 'sticky_posts' ) );

At the moment this tells the slider to only display posts marked as ‘featured’.

To display recent posts, change this line to

$args = array( 'posts_per_page' => 6);

which will show the six most recent posts in the slider. It’s probably best to leave the ‘posts_per_page’ as 6, otherwise the slider can start to look messy.

An alternative to showing all recent posts is to show recent posts from a particular category. In which case you need to change the line to

$args = array( 'posts_per_page' => 6, 'cat' => 161 );

which will show the six most recent posts in the category with id 161. You can find the id for your categories by hovering over their name in the category manager.

The url will contain something like:


where the number after ‘tag_ID’ is the category ID number.

Changing the Other Front Page Elements

It’s also possible to change the ‘recent articles’ and ‘more articles’ front page elements.

To do this we need to edit the file “page-template-front.php“. As before copy this from the Oxygen theme folder into your child theme folder before editing.

Recent Articles

To change the ‘recent articles’ section, look for the line:

$args = array( 'post__not_in' => get_option( 'sticky_posts' ), 'posts_per_page' => 3, 'meta_key' => '_oxygen_post_location', 'meta_value' => 'primary' )

and change it in a similar fashion to the slider. To the three most recent posts, use this line:

$args = array( 'posts_per_page' => 3);

More Articles

You can also change the ‘more articles’ section in a similar way by editing the line

$args = array( 'post__not_in' => get_option( 'sticky_posts' ), 'posts_per_page' => 12, 'meta_key' => '_oxygen_post_location', 'meta_value' => 'secondary' );

Again, we can just replace this with something like:

$args = array( 'posts_per_page' => 5);

where this time we will show five posts instead of just three.

See here for an example of the recent posts slider.