All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.


Author Topic: How do I get (3 minutes ago) for "Today"  (Read 4974 times)

0 Members and 1 Guest are viewing this topic.

Offline mashreza

  • Newbie
  • *
  • Posts: 3
    • View Profile
How do I get (3 minutes ago) for "Today"
« on: 06 June 2008, 14:26 »
WordPress 2.5
WordPress Default Theme 1.6
WP-RelativeDate 1.3

I'm currenlty using
Code: [Select]
relative_post_the_date('j F, l, Y');

It's showing "4 June, Wednesday, 2008 (2 days ago)" which is beatuifull. But for the posts on each day it only shows "Today".

How do I get it to say "Today (4 minutes ago)" ??

Thanks for your help in advance.

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: How do I get (3 minutes ago) for "Today"
« Reply #1 on: 06 June 2008, 17:41 »
Try:
Code: [Select]
echo relative_post_the_date('j F, l, Y').' ('.relative_post_time('', 1).')';

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline mashreza

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: How do I get (3 minutes ago) for "Today"
« Reply #2 on: 06 June 2008, 18:50 »
Thanks. That worked great. the only problem is if it's not "Today" it will show the "( )". Example: "Yesterday ()".

any suggestions on specifying the "()" only for today?

Offline mashreza

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: How do I get (3 minutes ago) for "Today"
« Reply #3 on: 06 June 2008, 19:29 »
I came up with a workaround... it's just not az pretty as I want it... but it works...

I call the function with $display variable set to false in order to get an output from the function and then test the output, if it's == "Today", then output the suggested code GaMerZ, else, just print the output...

Code: [Select]
$postDate = relative_post_the_date('F j, Y','','','',false);

echo $postDate == "Today" ? $postDate . ' ('.relative_post_time('', 1).')' : $postDate;


it would be great if anyone could suggest a cleaner code for this purpose.

Thanks

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: How do I get (3 minutes ago) for "Today"
« Reply #4 on: 07 June 2008, 03:13 »
I think that is the shortest code. If I were to right it, I will use the usual if statement rather than the short if.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.