/
www
/
wwwroot
/
fxdst.com
/
wp-content
/
themes
/
fxdst
/
Upload File
HOME
<?php /* Template Name: 文章列表 */ get_header(); include( 'templates/header-nav.php' ); // 获取文章列表 $fxdst_blog_page_id = get_queried_object_id(); $fxdst_blog_page_url = get_permalink($fxdst_blog_page_id); $fxdst_blog_page_title = get_the_title($fxdst_blog_page_id); $fxdst_blog_keyword = isset($_GET['keyword']) ? sanitize_text_field(wp_unslash($_GET['keyword'])) : ''; $fxdst_blog_cat = isset($_GET['cat']) ? absint($_GET['cat']) : 0; $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'paged' => $paged, ); if($fxdst_blog_cat > 0) $args['cat'] = $fxdst_blog_cat; if($fxdst_blog_keyword !== '') $args['s'] = $fxdst_blog_keyword; $args = apply_filters('io_blog_post_query_var_filters', $args); query_posts( $args ); $fxdst_blog_categories = get_categories(array( 'taxonomy' => 'category', 'hide_empty' => true, 'orderby' => 'name', 'order' => 'ASC', )); $fxdst_blog_filter_args = array(); if ($fxdst_blog_keyword !== '') { $fxdst_blog_filter_args['keyword'] = $fxdst_blog_keyword; } ?> <div class="main-content page"> <?php include( 'templates/header-banner.php' ); ?> <div class="container"> <div class="row mt-5 mt-sm-0"> <div class="col-12 mx-auto"> <div class="panel panel-default fxdst-archive-panel"> <?php get_template_part( 'templates/breadcrumb' ); ?> <header class="fxdst-archive-head"> <span class="fxdst-eyebrow">内容指南</span> <h1><?php echo esc_html($fxdst_blog_page_title); ?></h1> <p>汇总和分享 AI 工具、SaaS 产品、独立开发和全球科技工具选型相关的实用内容。</p> </header> <div class="fxdst-blog-controls"> <form class="fxdst-blog-search" method="get" action="<?php echo esc_url($fxdst_blog_page_url); ?>" role="search"> <label class="screen-reader-text" for="fxdst-blog-keyword">搜索文章</label> <input id="fxdst-blog-keyword" type="search" name="keyword" value="<?php echo esc_attr($fxdst_blog_keyword); ?>" placeholder="搜索 AI 工具、模型平台、SaaS 方法"> <?php if ($fxdst_blog_cat > 0) : ?> <input type="hidden" name="cat" value="<?php echo esc_attr($fxdst_blog_cat); ?>"> <?php endif; ?> <button type="submit" aria-label="搜索"><i class="fa fa-search"></i></button> </form> <nav class="fxdst-blog-tabs" aria-label="文章分类"> <a class="<?php echo $fxdst_blog_cat === 0 ? 'active' : ''; ?>" href="<?php echo esc_url(add_query_arg($fxdst_blog_filter_args, $fxdst_blog_page_url)); ?>">全部</a> <?php foreach ($fxdst_blog_categories as $fxdst_blog_category) : $fxdst_tab_args = array_merge($fxdst_blog_filter_args, array('cat' => $fxdst_blog_category->term_id)); ?> <a class="<?php echo $fxdst_blog_cat === (int) $fxdst_blog_category->term_id ? 'active' : ''; ?>" href="<?php echo esc_url(add_query_arg($fxdst_tab_args, $fxdst_blog_page_url)); ?>"> <?php echo esc_html($fxdst_blog_category->name); ?> </a> <?php endforeach; ?> </nav> </div> <div class="cat_list fxdst-archive-list"> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post();?> <article class="list-content fxdst-archive-card"> <div class="fxdst-archive-card-meta"> <?php $category = get_the_category(); if(!empty($category)){ ?> <span><i class="fa fa-folder mr-1"></i> <a href="<?php echo get_category_link($category[0]->term_id ) ?>"><?php echo $category[0]->cat_name ?></a> </span> <?php } ?> <span><i class="fa fa-calendar mr-1"></i> <time><?php echo get_the_time('Y-m-d G:i') ?></time> </span> </div> <h2 class="post-title"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="list-title"><?php the_title(); ?></a> </h2> <p class="list-desc"><?php echo esc_html(io_get_excerpt(150)); ?></p> <a class="fxdst-archive-read" href="<?php the_permalink(); ?>" aria-label="<?php the_title_attribute(); ?>">阅读全文<i class="fa fa-angle-right"></i></a> </article> <?php endwhile; else: ?> <div class="fxdst-blog-empty"> <i class="fa fa-search"></i> <strong>暂无相关文章</strong> <p>换个关键词或分类再试试。</p> </div> <?php endif;?> </div> <div class="posts-nav"> <?php echo paginate_links(array( 'prev_next' => 0, 'before_page_number' => '', 'mid_size' => 2, 'add_args' => array_filter(array( 'keyword' => $fxdst_blog_keyword, 'cat' => $fxdst_blog_cat > 0 ? $fxdst_blog_cat : null, )), ));?> </div> </div> </div> </div> </div> <?php get_footer(); ?>