WordPress.org

Ready to get started?Download WordPress

Forums

Separate frontpage template (4 posts)

  1. ByteWarrior
    Member
    Posted 10 years ago #

    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.)

  2. charle97
    Member
    Posted 10 years ago #

    modify your rewrite rules to point to different templates by replacing index.php with something like frontpage.php for your frontpage template.

  3. ByteWarrior
    Member
    Posted 10 years ago #

    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....

  4. charle97
    Member
    Posted 10 years ago #

    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]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.