• Resolved magicalwonders

    (@magicalwonders)


    Hi Folks,

    I’m building my own theme and have looked at the Codex regarding including the archives.php template, but am a bit confused.

    Then from the Admin Panel, Write > Write Page

    I assume this action has now been replaced by “go to Pages and Add New”?

    The final instruction is

    In the sidebar open the Page templates box, and select the Archives template

    Not sure what sidebar is being referenced? Hope someone can advise where I might find this “page templates box”

    Many thanks,

    Myles

Viewing 3 replies - 1 through 3 (of 3 total)
  • In the Add New Page screen there is a section in the right sidebar that reads: Attributes

    You can set the parent page, the template (which apparently is what you are after) and the page order.

    Assuming that you have created the template file correctly as described in the Codex, then your archives template should be available in the drop-down menu there.

    Thread Starter magicalwonders

    (@magicalwonders)

    O.K. I have created the following file called archives.php

    <?php get_header(); ?>
    
    <div id="mainContent" class="column">
    
    <?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>
    
    <?php get_footer(); ?>

    This file has been uploaded to my themes directory. However, when I go to add new page and click on drop down list under attributes, the only items showing are the pages that have already been created. There are no template files to select.

    Am I missing a step here?

    Thread Starter magicalwonders

    (@magicalwonders)

    I’ve just discovered I needed to add this code to the top of my template…

    <?php
    /*
    Template Name: Archives
    */
    ?>

    Thanks to this blog for providing the solution – https://jeff-way.com/2009/05/12/add-an-archives-page-to-your-wordpress-theme/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Including Archives.php problem’ is closed to new replies.