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 -->
这是在一个特殊的章节称为article.php – NorthwoodsCreative