Title: Template Selection based on Date?
Last modified: August 19, 2016

---

# Template Selection based on Date?

 *  Resolved [locusta](https://wordpress.org/support/users/locusta/)
 * (@locusta)
 * [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/)
 * I’m working on a Comicpress site and need to allow readers to comment on the 
   comic and the blog when the posts are on the homepage, but completely hide the
   comic comments on older comics. I’m thinking of doing this one of two way. Can
   anyone tell me if either are possible?
 * 1) Create a separate single.php template (which controls the page you can read/
   write comments on) based on publish date. Either by setting a specific number
   of days to swap templates or by somehow stating “published comic post after the
   most recent comic post”.
 * 2) Moving the commenting function completely to the homepage and then hiding 
   it when some sort of dynamic dropdown.
 * Are one or both of these options possible? Is there an easier way?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Frumph](https://wordpress.org/support/users/frumph/)
 * (@frumph)
 * [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/#post-1511904)
 * Just to ask, have you figured out how to have comments display on the home page
   to begin with?
 *  Thread Starter [locusta](https://wordpress.org/support/users/locusta/)
 * (@locusta)
 * [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/#post-1511935)
 * Honestly no. Not within the WordPress system, although it seems to me that I 
   should be able to call a comments template to the homepage. That’s why I was 
   wondering if this is even possible or what a reasonable work around would be.
 *  Thread Starter [locusta](https://wordpress.org/support/users/locusta/)
 * (@locusta)
 * [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/#post-1511936)
 * Quick update, I did figure out how to get comments to display on the homepage
   after some more digging on the forums here. The following code will call the 
   comment template:
 *     ```
       <?php  $withcomments = "1";
         comments_template('', true); ?>
       ```
   
 * Now I have a bunch of tweaking to try and keep the comments from routing me to
   the single.php page after leaving a comment. :-/ Which is probably easier said
   than done…
 *  Thread Starter [locusta](https://wordpress.org/support/users/locusta/)
 * (@locusta)
 * [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/#post-1511938)
 * Ok, I was able to get a redirect back to the index page after commenting by editing
   the wp-comment-post file (not my favorite thing to messing with but…). So I’m
   not being redirected to the single.php page anymore. Also commented out the comment
   template on the single.php pages.
 * I am, however, getting a 404 when I try to click through the archive to the most
   recent page. Could something I did with this comment adjusting have done that
   or have I screwed something else up?
 *  [Frumph](https://wordpress.org/support/users/frumph/)
 * (@frumph)
 * [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/#post-1511943)
 * .. You probably messed something up when you edit code like that. Why .. pray
   tell are you so concerned about having the comments on the index page only?, 
   or at all?
 * I guess I can understand viewing them.. sure .. but after that page is archived
   they’re gone for good according to your model.
 *  Thread Starter [locusta](https://wordpress.org/support/users/locusta/)
 * (@locusta)
 * [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/#post-1511952)
 * It’s by request from my client, but essentially we want readers to be able to
   comment on the current page, but not be able to comment or see comments on past
   pages. My understanding is that to comment on an “post”, WordPress routes the
   reader to the single.php page to do the commenting, etc. But that would leave
   the comic pages in the archive with comments visible on them.
 * If there is a more elegant solution, I’d be all for it. Just turning off comments
   after a set time isn’t really sufficient.
 *  Thread Starter [locusta](https://wordpress.org/support/users/locusta/)
 * (@locusta)
 * [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/#post-1511955)
 * I seem to have shaken out the bugs and gotten this to work. Thank you for your
   help.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Template Selection based on Date?’ is closed to new replies.

## Tags

 * [commenting](https://wordpress.org/support/topic-tag/commenting/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * 7 replies
 * 2 participants
 * Last reply from: [locusta](https://wordpress.org/support/users/locusta/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/template-selection-based-on-date/#post-1511955)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
