• 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();.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Noel Forte

    (@fortissimo95)

    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.

    https://dev.noelforte.com/blog/

    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.

    Thread Starter Noel Forte

    (@fortissimo95)

    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.

    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.

    Thread Starter Noel Forte

    (@fortissimo95)

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Creating an Archive Template’ is closed to new replies.