WordPress.org

Support

Support » How-To and Troubleshooting » Separate frontpage template

Separate frontpage template

  • Is it possible to make one template for index.php and one for the posts themselves?
    I’m searching a way to display a couple of posts on the frontpage with “off-topic” info (the about stuff and so on). If you click on a permalink, you end up at a page with the post template. It only shows the post and additional information about the post (like the number of comments, the category).
    I think the biggest problem is the use of “nice url’s”. Maybe the solution could do this (I’m not a php-programmer, so I’ll say it in plain English 🙂 :
    If index.php (or nothing) then use frontpage template. If else then use post template. (Or something like that.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • modify your rewrite rules to point to different templates by replacing index.php with something like frontpage.php for your frontpage template.

    But wouldn’t that screw up the whole rewriterule system??
    And could you give an example please. I’m not that good at RewriteRules :-). Thanks….

    you probably can leave your index.php file alone to serve as your frontpage template and then create a new individual archive template. use rewrite rules to point an address to a certain temmplate.
    for a different individual archive template called ‘individual-template.php’-
    old
    RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    new
    RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$ /individual-template.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    for a different category template called ‘category-template.php’-
    old
    RewriteRule ^archives/category/?(.*) /index.php?category_name=$1 [QSA]
    new
    RewriteRule ^archives/category/?(.*) /category-template.php?category_name=$1 [QSA]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Separate frontpage template’ is closed to new replies.