Hi
To add the published time you need to edit the file corresponding with the post template used and add this line of code like here: http://screencast.com/t/qLlMiEp0rkp โ http://screencast.com/t/NyGF96PyB
<?php echo get_the_time('g:i a'); ?>
If you want a different format for the time please check this link https://codex.wordpress.org/Formatting_Date_and_Time and modify the parameters from the functions as you need.
Let me know how it goes.
Thanks!
-
This reply was modified 10 years by
Andrei L..
Its works ๐ , but only in single post views, dont show time on block over image or next to date. ๐
du have solution Vijesti iz Hrvatske
How can be resolved here on slide-module like this $buffy .= $this->get_date();:
File: includes/modules/td_module_slide.php
<?php
class td_module_slide extends td_module {
function __construct($post) {
//run the parrent constructor
parent::__construct($post);
}
function get_title_main() {
$buffy = '';
$buffy .= '<div class="td-sbig-title-wrap">';
$buffy .='href . '" rel="bookmark" title="' . $this->title_attribute . '">';
$buffy .= $this->get_title();
$buffy .='';
$buffy .= '</div>';
return $buffy;
}
function render($td_column_number, $td_post_count, $td_unique_id_slide) {
$buffy = '';
$buffy .= '<div id="' . $td_unique_id_slide . '_item_' . $td_post_count . '" class = "' . $this->get_module_classes(array("td-image-gradient")) . '" ' . $this->get_item_scope() . '>';
switch ($td_column_number) {
case '1': //one column layout
$buffy .= $this->get_image('td_300x350');
break;
case '2': //two column layout
$buffy .= $this->get_image('td_640x350');
break;
case '3': //three column layout
$buffy .= $this->get_image('td_1021x580');
break;
}
$buffy .= '<div class="slide-meta ">';
if (td_util::get_option('tds_category_module_slide') == 'yes') {
$buffy .= '<span class="slide-meta-cat">';
$buffy .= $this->get_category();
$buffy .= '</span>';
}
$buffy .= $this->get_title();//$this->get_title_main();
$buffy .= '<span class="slide-meta-author">';
$buffy .= $this->get_author();
$buffy .= $this->get_date();
if (td_util::get_option('tds_p_show_views') != 'hide') {
$buffy .= '<div class="td-slide-views"><i class="td-icon-views"></i>' . td_page_views::get_page_views($this->post->ID) . '</div>';
}
$buffy .= $this->get_comments();
$buffy .= '</span>';
$buffy .= '</div>';
$buffy .= '</div>';
return $buffy;
}
function get_category() {
$buffy = '';
//read the post meta to get the custom primary category
$td_post_theme_settings = get_post_meta($this->post->ID, 'td_post_theme_settings', true);
if (!empty($td_post_theme_settings['td_primary_cat'])) {
//we have a custom category selected
$selected_category_obj = get_category($td_post_theme_settings['td_primary_cat']);
} else {
//get one auto
$categories = get_the_category($this->post->ID);
if (!empty($categories[0])) {
if ($categories[0]->name === TD_FEATURED_CAT and !empty($categories[1])) {
$selected_category_obj = $categories[1];
} else {
$selected_category_obj = $categories[0];
}
}
}
if (!empty($selected_category_obj)) { //@todo catch error here
$buffy .= 'cat_ID) . '">' . $selected_category_obj->name . '' ;
}
//return print_r($post, true);
return $buffy;
}
//overwrite the default function from td_module.php
function get_comments() {
$buffy = '';
if (td_util::get_option('tds_p_show_comments') != 'hide') {
$buffy .= '<div class="td-slide-comments"><i class="td-icon-comments"></i>';
$buffy .= 'post->ID) . '">';
$buffy .= get_comments_number($this->post->ID);
$buffy .= '';
$buffy .= '</div>';
}
return $buffy;
}
}
//td-icon-views
Hi
To display the time on blocks you need to edit the modules used to display that specific block and add the indicated line of code where you want to display it. You can check what modules are used for a block i theme panel: http://screencast.com/t/Jorjnvme7uH
You will need a new container for the time and some css code in order to be displayed fine on the page. For the in module_slide you can add the line which display the time here: http://screencast.com/t/rxvdgzxJMZ – http://screencast.com/t/RTtL7VgbxNE
For modules the php code will look like this:
$buffy .= '<div class="time">' . get_the_time('g:i a') . '</div>';
Also add this css in theme panel > custom code > custom css:
.time{
display: inline-block;
margin-left: 7px;
}
Note that I’ve test this css code only for td_module_slide For others modules you may need a different value for the margin.
Thanks!
-
This reply was modified 10 years by
Andrei L..
Hey Andrei
I just realized that code put in module only show 18:35 old day ๐
When view post,
time for publish its on place and work correct. Shows time when post is published.
Du have solutions code ๐ for module slide and another module.
$buffy seams don’t work or i made mistakes
$buffy .= '<div class="time"><i class="ico ico-time"></i>' . get_the_time('H:i') . '</div>';
Thanks in Advance
