Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
Kelvin
tagDiv Member

Hello,

I noticed that the function “$this->get_date()” returns a lot of CSS and HTML like this:
“<span class=”td-post-date”><time class=”entry-date updated td-module-date” datetime=”2018-12-14T17:33:41+00:00″ >14th Dec. 2018 @ 05:33 pm</time></span>”

which made the function strtotime( $this->get_date() ) fail.

The Solution.
Using the function “get_the_time(‘U’, $this->post->ID)”, I was able to get the timestamp of the post and using the code below, i was able to achieve the question I asked.

<?php echo ( get_the_time(‘U’, $this->post->ID) > strtotime( “5 days ago” ))? human_time_diff( get_the_time(‘U’, $this->post->ID), current_time(‘timestamp’) ). ‘ ago’ : $this->get_date(); ?>

for post less than 5 days ago, it will display the “ago”, while if the post is more than 5 days ago, it will display the date

Try and see if it works for you.

Kelvin
tagDiv Member

Hello,

Thanks for the reply.

I used the code:
<?php echo human_time_diff( get_the_time(‘U’, $this->post->ID), current_time(‘timestamp’) ). ‘ ago’; ?>

on the modules and it seems to be working but for post older than 7 days, its still showing months and even years ago.

I have tried using the strtotime() function on it but there was nothing returned.

How can I only show the time ago if the post is not older than 7 days?

Kelvin
tagDiv Member

Hello,

Thanks for the update.
I will take a look at the transients and see how to manage them.

Best Regards

Kelvin
tagDiv Member

Hello,

As a News and Media website, these things should be put in place.
I have more than 40 categories..

With what you are saying now, i cant display all my categories for my users unless i use something like a tag cloud in the footer or somewhere else.

This should be added on your next theme update please.

Regards,
Kasnet

Kelvin
tagDiv Member

Hello,

But as you can see from the screenshot i gave to you, its possible to have that kind of layout.

I will recommend you make our layouts flexible for users using your template so use the desired layout of their choice.

Great theme anyway.
When im done designing my webpage, i will display it for you to see.

Regards,
Kasnet

Viewing 5 posts - 1 through 5 (of 5 total)