I am trying to: Show date with a part in superscript
I visited this URL: hidden link
I've a custom date field. I'm using following code to show the date:
[types field='tour-start-date' style='text' format='jS F Y'][/types]
Now I wanted to show the part of the date - example(1st), (5th), (2nd), (3rd), is superscript.
Based on this doc: https://codex.wordpress.org/Function_Reference/the_modified_date#Date_with_superscript_or_subscript_number_suffixes
I updated the code from: [types field='tour-start-date' style='text' format='jS F Y'][/types] to
[types field='tour-start-date' style='text' format='j\<\s\u\p\>S\<\/\s\u\p\> F Y'][/types]
as well as
[types field='tour-start-date' style='text' format='j \<\s\u\p\>S\<\/\s\u\p\> F Y'][/types]
I expected to see:
the latter part of the date i.e. (1st), (5th), (2nd), (3rd), is superscript.
Instead, I got:
In the first case, the date does not come, instead I get the following text: 00000000p
In the second case, the date comes, and still get the following text: 00000000p
In both the cases, the desired characters do not come in second case.
This is how I do this (I needed to bold just the year):
Just wrap your date tags in superscript html tags
This should look like this:
[types field='tour-start-date' style='text' format='j'][/types]<sup>[types field='tour-start-date' style='text' format='S'][/types]</sup> [types field='tour-start-date' style='text' format='F Y'][/types]
Hope it helps.
D.
Dear shreyas,
There isn't such a feature within Types shortcode, see document:
https://toolset.com/documentation/customizing-sites-using-php/functions/#date
The valid parameter for attribute "format":
any valid WordPress date format
WordPress date and time formats:
https://codex.wordpress.org/Formatting_Date_and_Time
There isn't such an option "superscript", but you can try the workaround of D mentioned above:
https://toolset.com/forums/topic/date-in-superscript-format/#post-491262
And you can try to create your own custom shortcode for it:
https://codex.wordpress.org/Function_Reference/add_shortcode