WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Using Narchives with Include? (2 posts)

  1. ericakadisco
    Member
    Posted 7 years ago #

    Hi,

    I created a nice narchive page that works on it's own:

    http://approachanxiety.com/narchives.php

    But then when I try to use it as an include, the entries are missing and all I see are the category headers:

    http://approachanxiety.com/?page_id=3

    Here is the code for my template page:

    <?php
    /*
    Template Name: Archives
    */
    ?>
    <?php get_header(); ?>
    <?php get_sidebar(); ?>
    <div id="content" class="narrowcolumn">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><font color=#5C5858><?php the_title(); ?></font></h2>
    <div class="entry">
    <?php include('narchives.php'); ?>
    </div>
    </div>
    <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this entry.', '', '
    '); ?>
    </div>
    <?php get_footer(); ?>

    Am I using this the wrong way?

    Thanks!

  2. moshu
    Member
    Posted 7 years ago #

    Am I using this the wrong way?
    Yes!

    Don't create a separate physical file!
    Create a Page template with the code for whatever archives you want AND create a new Page by using that template. It's that simple.
    http://codex.wordpress.org/Pages#Page_Templates

Topic Closed

This topic has been closed to new replies.

About this Topic