diff --git a/wp-content/themes/nenghui-energy-theme-cn/archive.php b/wp-content/themes/nenghui-energy-theme-cn/archive.php index 34e0f8b..cba78ad 100644 --- a/wp-content/themes/nenghui-energy-theme-cn/archive.php +++ b/wp-content/themes/nenghui-energy-theme-cn/archive.php @@ -8,8 +8,9 @@
-
-

新闻资讯

+
+

新闻中心

+
-
-
- 'post', - 'posts_per_page' => 1, - 'post_status' => 'publish', - 'orderby' => 'rand' - )); - - if ($random_query->have_posts()) { - $random_posts = $random_query->posts; - // 随机文章缓存5分钟,避免频繁查询 - set_transient($cache_key, $random_posts, 300); - } else { - $random_posts = array(); - } - } - if (!empty($random_posts)) : - global $post; - foreach ($random_posts as $post) : - setup_postdata($post); - // 获取文章特色图片 - $featured_image = get_the_post_thumbnail_url(get_the_ID(), 'large'); - if (!$featured_image) { - $featured_image = get_template_directory_uri() . '/assets/images/default-post.jpg'; - } - - // 获取文章摘要 - $excerpt = get_the_excerpt(); - if (empty($excerpt)) { - $excerpt = wp_trim_words(get_the_content(), 30, '...'); - } - ?> -
-
- - <?php echo esc_attr(get_the_title()); ?> - -
-
-
- -

-
-

- -

- 查看更多 -
-
-
- -
-
- 暂无文章 -
-
-
-

暂无文章

-

- 目前还没有发布任何文章,请稍后再来查看。 -

- 返回首页 -
-
-
- -
-
-
+