0

So, I am wondering if there is a way that I can make this:

February 28th, 2020

Just output NO month and NO year so just 28th (i.e. just the date)

What approach would you take?

I am applying this to a WordPress plugin called Pods.

The plugin allows for Custom Fields to be printed like this:

{@date}

And I know that you can run a PHP command from the functions file like this:

{@date,remove_month}

But figuring how to do that is tricky...any pointers?

2
  • I'd guess if it accepts anything it'd be a PHP date format string: I guess you want jS. But how the plugin works / how you do this will be specific to the plugin, so you'd have to ask them or read the code to figure it out yourself.
    – Rup
    Feb 28, 2020 at 13:24
  • If the date is just a date in a string, then you don't need WordPress stuff to figure out the answer, it can be done entirely using raw PHP from php.net
    – Tom J Nowell
    Feb 28, 2020 at 13:58

1 Answer 1

1

You’ll need to write your OWN function that will take the post_date and return it reformatted to the style you’re looking for.

function my_date($input_date) {
   return date("S", strtotime($input_date));
}

And then you would call it within your Pods Template like

{@post_date, my_date}

All rights goes to Jim True. More infomations : https://pods.io/forums/topic/date-formatting-using-magic-tags/

1
  • Thank you VERY much FloJDM
    – Henry
    Feb 29, 2020 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.