Published X Minutes/Days Ago On Oxygen Builder

Published: October 24, 2020

If you're looking for an easy way to display a “this article was published 6 minutes ago” on your WordPress website built with Oxygen Builder, this article is for you.

This guide is specifically created for the Oxygen Builder repeater element, but it can definitely be expanded to easy posts, and even a non-Oxygen WordPress website.

First, insert your date into the repeater element by using the dynamic data aspect of the builder. Don't add any additional things to this date, keep it in its default format.

The only additional step that you need to take is inserting a code block, and pasting in this PHP.

The changes will not display in the builder, but on the front end of your Oxygen Builder website, the post date will show as “published 28 minutes ago”, or something like that.

Keep in mind; you can display “published x time ago” by using this method on any WordPress website, not specifically Oxygen. To do that, you would probably need to install a plugin called code snippets, and paste that PHP in there. Then, you may need to edit your theme files, make a child theme, or do some other back end alterations.

<?php

function iso_post_time_ago () {

return sprintf( esc_html__( '%s ago', 'textdomain' ), human_time_diff(get_the_time ( 'U' ), current_time( 'timestamp' ) ) );

}

add_filter( 'get_the_date', 'iso_post_time_ago' );?>

Join Our Newsletter
Here's what you get: A once a week newsletter that contains original content, aggregated posts, WordPress deals, and anything else we think you'd like. We don't spam or sell your email address. Unsub at any time.
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Briant
Briant
2 days ago

I can't seem to make this work

Briant
Briant
2 days ago
Reply to  Briant

the code was breaking my page with the repeater element. So I used this inside a code block and it worked flawlessly:

<?php

echo sprintf( esc_html__( '%s' ago, 'textdomain' ), human_time_diff(get_the_time ( 'U' ), current_time( 'timestamp' )));

?>

isotropic black Friday deal finder

Search, sort, and filter through the best BFCM WordPress deals online.
BROWSE DEALS

Affiliate Disclosure: Some links on this website are affiliate links. We make commissions for purchases made through those links.

We only recommend items/tools that we've personally used and like.

Full Disclosure | FTC Statement

Join Our Newsletter
Over 4,000 Design Lovers and Problem Solvers.

Author

A relationship driven website creation company.

Connect

© ISOTROPIC, LLC 2016-2021
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram