get_the_date function for specific post ID
-
Hi,
right, this is the new problem that is keeping me up all night.
i have created a function which allows me to get the date that a post was published, and i’ve created a shortcode so i can call it in the visual editor.
function thedate(){ return get_the_date('F jS,'); } add_shortcode('date', 'thedate');
so i then do the
[date]
shortcode in the visual editor and when i load the page it shows the date that page/post was first published.great.
except that i want to display the date that a DIFFERENT post was published.
ie, i’d type
[date id='243']
and the page would display the date that the post with id 243 was first published rather than the date of the page the shortcode is written in.any ideas? i feel like i’ve tried everything!
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘get_the_date function for specific post ID’ is closed to new replies.