Forums

Link to generic instance of archive.php (4 posts)

  1. mhale0
    Member
    Posted 2 years ago #

    Hi-

    I'm trying to do something which doesn't seem like it should be so tricky, but apparently is.

    I need to create a link (in my main navigation) to call up a generic archive page, displaying the 10 most current posts, previous and next links for pagination, etc., as well as month and category archive lists.

    I have come very close, using a custom Page template, but I can't seem to get pagination to work because I'm out of the main wp loop.

    When one of the category or month links on the "Archive" Page linked above is clicked the generic "archive.php" file is called, and the correct number of articles is displayed, along with pagination.

    Is there any way to call that same "archive.php" template directly without a specific query?

    Thanks

  2. Jonas Grumby
    Member
    Posted 2 years ago #

    If you want your only date-based archives to display your php template save a copy of it called date.php and upload it. Then all of your date-based archives would automatically use that template file instead of archive.php. If you want all archive pages to display with your template, save it as archive.php and upload it.

    See the Template Hierarchy map.

    Having posts from a specific category appear from a link on the page menu is indeed usually something you can do with a Page Template. The structure of a Page Template file is not all that different from that of a theme template file.

  3. mhale0
    Member
    Posted 2 years ago #

    Thanks for the reply, SS.

    I managed to get pagination working on the Archive page template, thanks to this article at weblogtoolscollection.com.

    So, my problem is solved, but in sort of an inelegant way. I'd like to continue to explore the topic though.

    To clarify: I have an archive.php template, and I also have a static page template called page-archive.php.

    The page-archive.php file is accessed from an "archive" link in the main navigation. It's purpose it to display the most recent posts as well as a category and month listing.

    The archive.php template is accessed when a category or date query is made, according to the template cascade hierarchy.

    My question, is there a way to access that archive.php template (NOT the static page template) from a hard coded link without a specific date or category query?

    Thanks!

  4. hixen
    Member
    Posted 1 year ago #

    Did you ever find a solution to this? or the right way to do it :D

Topic Closed

This topic has been closed to new replies.

About this Topic