2017-07-27 154 views
1

我的主題開發人員不會幫助我回答如何將此功能添加到當前主題。我查看了Wordpress文檔,並嘗試將代碼添加到function.php文件,但它將代碼放在頁面的頂部。我試圖添加PHP代碼的Wordpress建議,但它打破了主題。添加WordPress更新發布日期PHP

看起來這是一個自定義代碼,因爲它是一個自定義主題。

任何幫助將是最受歡迎的。

目前:
2017年7月11日在類別0評論

期待有:
2017年7月11日在類別0評論
更新時間:7月23日, 2017 at 7:00 am

  <!-- ARTICLE DATE : begin --> 
       `<div class="article-date"> 
        <i class="ico tp tp-clock2"></i> 
        <span class="article-date-holder"> 
        <?php if (lsvr_get_field('article_detail_categories_enable', true, true)) : ?> 
         <?php $categories_html = ''; ?> 
         <?php $terms = wp_get_post_terms(get_the_id(), 'category'); ?> 
         <?php foreach ($terms as $term) : ?> 
          <?php $categories_html .= '<a href="' . get_term_link($term) . '">' . $term->name . '</a>, '; ?> 
         <?php endforeach; ?> 
         <?php if ($categories_html !== '') : ?> 
          <?php $categories_html = rtrim($categories_html, ', '); ?> 
          <?php echo sprintf('%s in %s', get_the_date(), $categories_html); ?> 
         <?php else: ?> 
          <?php echo get_the_date(); ?> 
         <?php endif; ?> 
        <?php else: ?> 
         <?php echo get_the_date(); ?> 
        <?php endif; ?> 
        </span> 
        <?php if (lsvr_get_field('article_detail_author_enable', false, true)) : ?> 
        <span class="article-author"> 
         <?php echo sprintf('by %s', get_the_author_posts_link()); ?> 
        </span> 
        <?php endif; ?> 
        <?php if(comments_open()) : ?> 
        <span class="article-comments"> 
         <?php $comment_count = get_comment_count(get_the_ID()); ?> 
         <a href="<?php the_permalink(); ?>#comments"><?php echo @sprintf(__('%d comments', 'lsvrtheme'), $comment_count['approved']); ?></a> 
        </span> 
        <?php endif; ?> 
       </div>` 
       <!-- ARTICLE DATE : end --> 

回答

0

你正在尋找的功能可能是the_modified_time().

不要把functions.php中的代碼,而是呼應the_modified_time()(以及任何參數)在您需要的修改時間文本模板文件顯示(在循環中使用以獲取有關當前帖子的信息)。

+0

這是在一個特殊的章節稱爲article.php – NorthwoodsCreative