0

I am attempting to create an archives page that would have links to authors, categories, tags, etc. I would like it so that when the author, for example, is clicked, all their posts are displayed. Currently, if you go to http://diginomics.com/archive/ you see that clicking the link only brings you back to the archive page, essentially creating a loop.

This is my current code for the archive page template archive.php:

    <?php the_post(); ?>

    <h3>Posts by author:</h3>

    <?php $args = array(
        'orderby'       => 'name', 
        'order'         => 'ASC', 
        'number'        => null,
        'optioncount'   => false, 
        'exclude_admin' => true, 
        'show_fullname' => false,
        'hide_empty'    => true,
        'echo'          => true,
        'style'         => 'list',
        'html'          => true ); ?>

    <ul>
        <?php wp_list_authors( $args ); ?>
    </ul>

    <h3>Archive by month:</h3>

    <ul>
        <?php wp_get_archives('type=monthly'); ?>
    </ul>

    <h3>Archive by category:</h3>

    <ul>
         <?php wp_list_categories( 'title_li=' ); ?>
    </ul>

    <h3>All posts alphabetically:</h3>

    <ul>
        <?php wp_get_archives('type=alpha'); ?>
    </ul>

    <h3>Tag cloud:</h3>

    <ul>
        <?php wp_tag_cloud(); ?>
    </ul>

What am I doing wrong and what do I need to change to get the desired effect?

0

Don't name your custom page template archive.php. If you refer to the Template Hierarchy, you'll see that archive.php is the template WordPress loads for archives if a more specific template isn't available.

|improve this answer|||||
  • Followed this advice which seemed to work well enough, but now when I click on a specific author to look up, I get some random post before the results. Check it out and you will see what I mean. Code remains the same. – Travis Patron Dec 24 '14 at 5:31
  • I can't explain that without seeing your templates. Look at the template hierarchy, figure out what template your author archives is loading, and look at the code for that particular template. – Milo Dec 24 '14 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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