WordPress.org

Ready to get started?Download WordPress

Forums

Creating an Archive Template (6 posts)

  1. Noel Forte
    Member
    Posted 1 year ago #

    I want to set up an archive page template so that I can make changes to my pages based on the template that they are using. I've already made a lot of changes to "archive.php" to suit my default needs, my question is, is there a way to make a template that functions as a working copy of "archive.php" that I would be able to tweak depending on the page? I figured out pretty fast that copying and pasting the code from "archive.php" doesn't work, as it turns the page that is utilizing the template into a post and displays it like a 1-post archive page that links to itself.

    Thoughts? I was considering using get_posts(); to query, but I don't know if I can do multiple pages with get_posts();.

  2. Noel Forte
    Member
    Posted 1 year ago #

    Here's a link to the page that I'm having a problem with. I want to use it as an archive page, and call a post format (content-*name*.php), but I want to use it as a page template and not call it as the "posts" page.

    http://dev.noelforte.com/blog/

  3. cynnie88
    Member
    Posted 1 year ago #

    I'm sorry, I have read this a dozen times and it is still unclear what you are trying to do here, I get the feeling that you may be over-complicating the problem.

  4. Noel Forte
    Member
    Posted 1 year ago #

    I think that I might be as well. Let's try again.

    Basically, I want to assign archive.php a template name. Unfortunately, duplicating it, renaming it to something such as "blog.php", adding:

    /*
    *Template Name: Blog Template
    */

    to the top of the page, creating a new page in WordPress, and adding the template to it generates the result above as seen in the link. (In this case, the page is called blog.) Clicking the post on that page simply returns the page you were already on.

    So in a nutshell, the task is still: make archive.php into a template, so I can apply custom styles and code to it.

  5. cynnie88
    Member
    Posted 1 year ago #

    You are trying to use a post-listing template for a page that doesn't have posts. You either need to write a query into the template file or use the file as a category specific template.

  6. Noel Forte
    Member
    Posted 1 year ago #

    Thanks. I figured that I'd probably have to do something like this. I'll keep this post open in case I run into anything.

Topic Closed

This topic has been closed to new replies.

About this Topic