You could just put code in your modified category.php file to check for $_GET[‘template’] == ‘archive’, and use the correct logic based on that.
If you really need separate templates, you can use the approach below. Since I do not know if you have a special name for your modified category.php, the example assumes you did not rename it.
Create category-archive.php to show the full category. Rename your modified category.php to category-modified.php. Save the file below to category.php.
<?php
// category-archive.php shows the full category
// category-modified shows posts with expiration date
if ( $_GET['template'] == 'archive' ) {
include(TEMPLATEPATH . '/category-archive.php'); }
else {
include(TEMPLATEPATH . '/category-modified.php');
}
?>
Ok, but how can I link it in the menu? It will be the same category so the link would be like – http://localhost/?cat=86 for example, I’ll have the category “Anouncements” and I need a link named “Archive” that leads to the same category but loads the second template so the expired posts are shown ?
Use the WP Menu builder with Custom Links and add the argument ‘template=archive’ to the proper item.
Thanks a lot, that did the trick
A small issue came up, when I go to the archive page and hit to go next page (second page of posts) it keeps repeating the posts on the second page endlessly, the entire loop is repeated one after another.
What could be causing it, the link is http://localhost/?cat=35&template=archive&paged=2
Loop code: `
[Code moderated as per the Forum Rules. Please use the pastebin]