到wordpress中指向archive.php的链接

问题描述 投票:0回答:1

我的single.php中有以下代码,它输出以下链接

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS80RFU2by5qcGcifQ==” alt =“在此处输入图像描述”>

<div class="dt"><?php echo get_the_date();?></div>

<div class="cat">
<?php the_category(', ');?>
</div>

<div class="tag">
  <?php the_tags();?>

</div>

<div class="arc">
<a href="<?php echo get_post_type_archive_link( 'post' ); ?>">Archives</a>
</div>

到类别和标签的链接都正在通过category.php和tag.php产生输出,但是,我无法弄清楚如何链接到计划显示后期存档的archive.php

php wordpress archive
1个回答
0
投票

只是让您知道没有像您描述的那样默认创建的完整存档页面。

引用此链接:https://codex.wordpress.org/Creating_an_Archive_Index

<?php

/*
Template Name: Archives
*/
get_header(); ?>

<div id="container">
    <div id="content" role="main">

        <?php the_post(); ?>
        <h1 class="entry-title"><?php the_title(); ?></h1>

        <?php get_search_form(); ?>

        <h2>Archives by Month:</h2>
        <ul>
            <?php wp_get_archives('type=monthly'); ?>
        </ul>

        <h2>Archives by Subject:</h2>
        <ul>
             <?php wp_list_categories(); ?>
        </ul>

    </div><!-- #content -->
</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

以这种方式访问​​档案:

<?php wp_get_archives('type=yearly'); ?>
© www.soinside.com 2019 - 2024. All rights reserved.