get_the_time in Modules

Posted in: Newspaper
Post count: 10

Hi, i’m trying to add the time right next to each post on one of my blocks.

<div class=”td-module-meta-info”>
<?php if (td_util::get_option(‘tds_category_module_8’) == ‘yes’) { echo $this->get_category(); }?>
<?php echo $this->get_author();?>
<?php echo $this->get_date();?>
<?php echo get_the_time(‘H:i | ‘, $this->post->ID);?>
<?php echo $this->get_comments();?>
</div>

The above code doesn’t work as it displays 00:00 for each post. How can i achieve this?

Post count: 20688

Hi,

You could modify the date format in the WordPress settings based on the WordPress parameters, like this
https://codex.wordpress.org/Formatting_Date_and_Time
https://www.screencast.com/t/etMpZQjInB
This is the result
https://www.screencast.com/t/4x0pjOIfA
And this is the date format used in the example

F j, Y,g:i a

Thanks

Post count: 10

Hi and thank you for your reply. I knew i could change it in the settings, but i’ll rather have it separate to style it in a different way

Post count: 20688

Hi,

I have tried the code modification you mentioned for a module, and it seems to work for me from what I can tell
https://www.screencast.com/t/ditWexsJExm
https://www.screencast.com/t/bSxielGSE

Thanks

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.