• Resolved patv

    (@patv)


    I have created custom post types in my WordPress installation, and I want to use archive-{custom post type}.php in order to list the respective custom post types.

    The websites I’ve visited seem to indicate that i <i>must</i> use this archive template file directly on a page create in my wordpress for the specific purpose of listing these post types…

    I find this abit conflicting since archive.php is a default template file used and recognized by WordPress so in my mind it should be useable without creating a WordPress page for this. Is this possible? If so, what’s the URL I should expect to hit to get to this listing? is there a WordPress function that will generate me the permalink/url for this template file without having to create a new page?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter patv

    (@patv)

    I’ve been able to figure out the url for WordPress to point directory to my archives. Unfortunately, it’s calling my index.php template file instead of using my archive.php or variant of this template file.

    I’ve specified has_archives in the initialiation of my custom post types, though it doesn’t fix this problem.

    Thread Starter patv

    (@patv)

    Resolved. File misnamed. For any other readers, these are the steps required in order to create a listing of your custom posts:

    1- Register your custom post type reference. Be sure to specify has_archive.
    2-Create a template file called archive.php (NOT archives.php).
    3-Create sub template files such as archive-{custom post type}.php to retrieve specific listings.

    If, for example, your custom post is found at http://www.example.com/news/news-instance-1, then /news will be the level at which you will need to hit to get its archives page (so http://www.example.com/news/).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to link in archive.php template file’ is closed to new replies.