0

I have the following code in my single.php which outputs the following links

enter image description here

<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

1 Answer 1

0

Just to let you know there is no full archive page like you describe created by default.

Refer to this link: 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(); ?>

Access the archives like this:

<?php wp_get_archives('type=yearly'); ?>
1
  • I know about the solution you are suggesting. This is not what I am looking for. Please review my screenshot above (see 'Archives' link next to 'Flexbox' and 'Grid' tags)
    – Sergiy
    Commented Jun 9, 2020 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.