Hey!
Is it possible to customize the date field on a post so it is not just showing the date the post is “posted”?
I want to be able to make a post with custom postdates.
Because my site focuses on future events.
Hi,
@dillermand16 is possible with a plugin + custom code, i will give you the right solution step by step.
1. Install this plugin Advanced Custom Fields
2. Create a custom field like here: http://screencast.com/t/DvpIBngoAa
3. Add this code like here: http://screencast.com/t/UQ90sN6CbIj
code:
if( get_field('my-event-date') ) {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_field('my-event-date') . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_field('my-event-date') . '"/>';
} else {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_the_time(get_option('date_format'), $this->post->ID) . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_comments_number($this->post->ID) . '"/>';
}
4. Edit a post and you will have the date filed here: http://screencast.com/t/LRLiZkvujV
5. Done: http://screencast.com/t/LRLiZkvujV
Hope you manage it, if not please reply back.
Thanks!
Hey Marius. thank you very much!
Much appreciated. I did what you said but it is still just showing the “post date”
I did exactly what you said, but in a child theme. could that be the problem?
Actually it is now possible to show the “my-event-date” on the post page, like this:

But i want it to show up on the “loop post” too, is that possible? like this:

Thanks so far!
Hi,
As you can see here the modification is in loop to, the changes should be everywhere. http://screencast.com/t/SXzw4yvurmIr
Can you show me a link to your site.
Thanks!
Okay sounds strange. cause its not happening here.
I modified the file as you showed in. “/public_html/wp-content/themes/Newspaper/includes/wp_booster/td_module.php”
My page is here http://academicus.dk thanks for your time.
Btw, the post i made a custom “me-event-date” for is this.
http://academicus.dk/up-to-date/adobe-design-achievement-awards
-
This reply was modified 12 years by
dillermand16.
Hi,
Use this code instead of the above
if( get_field('my-event-date', $this->post->ID) ) {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_field('my-event-date', $this->post->ID) . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_field('my-event-date', $this->post->ID) . '"/>';
} else {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_the_time(get_option('date_format'), $this->post->ID) . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_comments_number($this->post->ID) . '"/>';
}
Thanks!
If i do that, i will get the following error.
Parse error: syntax error, unexpected 'private' (T_PRIVATE) in /data/home/academic/public_html/wp-content/themes/Newspaper/includes/wp_booster/td_module.php on line 317
I dont know what im doing wrong here.
this is my edited td module file if you can help.
Wow thanks got it to work now.
I apparently missted a closing in the code 🙂
} else {
$td_article_date_unix = get_the_time('U', $this->post->ID);
if( get_field('my-event-date', $this->post->ID) ) {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_field('my-event-date', $this->post->ID) . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_field('my-event-date', $this->post->ID) . '"/>';
} else {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_the_time(get_option('date_format'), $this->post->ID) . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_comments_number($this->post->ID) . '"/>';
}
}
Many many thanks
Hello.
I link to this post because I’m looking for a solution that I can’t find. I need into all articles that is showen the date and time. Im not skilled, could you help me?
regards.
