Costumize Show date

Posted in: Newspaper
Post count: 29

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.

Post count: 140

Theme Panel > Post Settings > SHOW DATE = Enable or disable the post date

🙂

Post count: 3343

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!

Post count: 29

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?

Post count: 29

Should the show date, be enabled or disabled?

Post count: 29

Actually it is now possible to show the “my-event-date” on the post page, like this:

post

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

loop post

Thanks so far!

Post count: 3343

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!

Post count: 29

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

Post count: 3343

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!

Post count: 29

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.

http://www.speedyshare.com/XHKKT/td-module-EDITED.php

Post count: 29

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

Post count: 3343

Hi,
I’m glad you have solved.
Have a nice day!

Post count: 27

It would also be great if there would be an option in the theme settings to change the date format for all posts as there is for the top header menu.

Post count: 12

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.

Post count: 7909

Hi,


@weblogging
I’ve replied on the other topic.

Thanks!

Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic.