代码拉取完成,页面将自动刷新
<?php
/*
* @Filename : index.php
* @Description :
* @Author : Zhang Zhijun <gallanthunter@163.com>
* @Copyright : Copyright (c) 2022 by chahuawu.com, All Rights Reserved.
* @License : Mulan PubL v2
* @Link : https://chahuawu.com
* @CreateTime : 2022-12-17 20:57:28
* @LastModifyTime: 2023-01-11 22:07:26
*/
get_header();
?>
<div class="bgn-container bgn-m-auto bgn-max-w-screen-xl bgn-leading-relaxed divide-y divide-fuchsia-300">
<!-- 推荐文章 -->
<div class="bgn-py-4">
<h1>精选文章</h1>
</div>
<div class="bgn-w-full bgn-flex bgn-flex-warp bgn-border-b bgn-border-gray-300">
<div class=""></div>
<!-- 图片/幻灯片 -->
<div class="bgn-w-full md:bgn-w-1/2">
</div>
<!-- 推荐文章 -->
<div class="bgn-w-full md:bgn-w-1/2 bgn-flex bgn-flex-col">
</div>
</div>
<!-- 最新文章 -->
<div class="bgn-py-4">
<h1>最新发布</h1>
</div>
<div class="bgn-w-full bgn-flex bgn-flex-wrap bgn-py-4 bgn-border-b bgn-border-gray-300">
<?php
$args = array(
'ignore_sticky_posts' => 1,
'orderby' => 'date',
'showposts' => 4
);
query_posts($args);
while (have_posts()) :
the_post();
?>
<article class="bgn-w-full md:bgn-w-1/2 bgn-pt-4 bgn-pr-4">
<!-- 文章标题 -->
<div class="bgn-pb-2">
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></h2>
</div>
<!-- 文章摘要 -->
<div class="bgn-font-light bgn-excerpt">
<?php
$excerpt = $post->post_excerpt;
if (empty($excerpt)) {
echo strip_tags(apply_filters('the_content', strip_shortcodes($post->post_content)));
} else {
echo strip_tags(apply_filters('the_excerpt', strip_shortcodes($post->post_excerpt)));
}
?>
</div>
<!-- 文章信息 -->
<div class="bgn-p-2">
<?php if (!is_category()) {
$category = get_the_category();
if ($category[0]) {
?>
<span class="bgn-pr-4 bgn-text-sm">
<i class="fa-sharp fa-solid fa-rectangle-list bgn-text-gray-400"></i>
<a href="<?php echo get_category_link($category[0]->term_id) ?>"><?php echo $category[0]->cat_name ?></a>
</span>
<?php }
}; ?>
<span class="bgn-pr-4 bgn-text-sm">
<i class="fa-solid fa-clock bgn-text-gray-400"></i>
<?php echo timeago(get_gmt_from_date(get_the_time('Y-m-d G:i:s'))) ?>
</span>
<span class="bgn-pr-4 bgn-text-sm">
<i class="fa-solid fa-eye bgn-text-gray-400"></i>
<?php deel_views('浏览'); ?>
</span>
</div>
</article>
<?php
endwhile;
wp_reset_query(); ?>
</div>
<!-- 热门文章 -->
<div class="bgn-py-4">
<h1>热门文章</h1>
</div>
<div class="bgn-w-full bgn-flex bgn-flex-wrap bgn-pb-4 bgn-b-border bgn-border-gray-500">
<?php
$args = array(
'ignore_sticky_posts' => 1,
'orderby' => 'comment_count',
'showposts' => 6
);
query_posts($args);
while (have_posts()) :
the_post();
?>
<article class="bgn-w-full md:bgn-w-1/3 bgn-py-4 bgn-pr-4">
<!-- 文章标题 -->
<div class="bgn-pb-2">
<h2><a href="<?php the_permalink() ?>"> <?php the_title(); ?></h2>
</div>
<!-- 文章摘要 -->
<div class="bgn-font-light bgn-excerpt">
<?php
$excerpt = $post->post_excerpt;
if (empty($excerpt)) {
echo strip_tags(apply_filters('the_content', strip_shortcodes($post->post_content)));
} else {
echo strip_tags(apply_filters('the_excerpt', strip_shortcodes($post->post_excerpt)));
}
?>
</div>
<!-- 文章信息 -->
<div class="bgn-p-2">
<?php if (!is_category()) {
$category = get_the_category();
if ($category[0]) {
?>
<span class="bgn-pr-4 bgn-text-sm">
<i class="fa-sharp fa-solid fa-rectangle-list bgn-text-gray-400"></i>
<a href="<?php echo get_category_link($category[0]->term_id) ?>"> <?php echo $category[0]->cat_name ?></a>
</span>
<?php }
}; ?>
<span class="bgn-pr-4 bgn-text-sm">
<i class="fa-solid fa-clock bgn-text-gray-400"></i>
<?php echo timeago(get_gmt_from_date(get_the_time('Y-m-d G:i:s'))) ?>
</span>
<span class="bgn-pr-4 bgn-text-sm">
<i class="fa-solid fa-eye bgn-text-gray-400"></i>
<?php deel_views('浏览'); ?>
</span>
</div>
</article>
<?php
endwhile;
wp_reset_query(); ?>
</div>
</div>
<!-- footer -->
<?php get_footer(); ?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。