[英]link to archive.php in wordpress
我的 single.php 中有以下代码,它输出以下链接
<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>
both links to category and tag are working producing output via category.php and tag.php, however, I can't figure it out how to link to archive.php where I plan to show post archive
只是为了让您知道没有像您描述的那样默认创建的完整存档页面。
参考这个链接: 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'); ?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.