Setting a static home page and blog page without using the settings

This may seem like a stupid question, and it probably isn’t possible, but is it possible for me to set a static home page (using front-page.php) and a blog page (using home.php, I think) in my theme, and have the blog page appear on a separate slug WITHOUT changing the page settings in my WordPress installation, under Settings > Reading? So http://www.mysite.com/blog/ will show my blog (home.php), and http://www.mysite.com/ will show my home page (front-page.php)?

EDIT
I should point out, as I didn’t point it out so explicitly earlier, I would like to avoid creating the pages in WordPress, if I can. Although @eyedarts does answer the question, it doesn’t give completely what I need. Although that may well have been my fault for not explaining that.

2 Answers
2

The answer appears to be that it is possible:

http://codex.wordpress.org/Creating_a_Static_Front_Page

Configuration of front-page.php

If it exists, the front-page.php template file is used on the site’s
front page regardless of whether ‘Settings > Reading ->Front page
displays’ is set to “A static page” or “Your latest posts,” the Theme
will need to account for both options, so that the site front page
will display either a static page or the blog posts index. There are a
few methods to do so.

As for the blog page, I think you can find what you’re looking for here:

http://codex.wordpress.org/Page_Templates

Specialized Page Template

Create a template for one Page: For more extensive changes, intended
for just one specific Page, you can create a specialized template
file, named with that Page’s slug or ID:

    page-{slug}.php
    page-{ID}.php

In that specialized/custom template file, use the get_posts() function (http://developer.wordpress.org/reference/functions/get_posts/) and other similar functions to get and list the posts.

You can use the add_posts_page() function (http://developer.wordpress.org/reference/functions/add_posts_page/) to add the page to the menu.

So, in your front-page.php, you’ll have a reference to a static page that you create in your code. You’ll then also create a second page for your blog page using the specialized page template.

I’d be curious to know if there’s an easier, more straight-forward way to do this.

Leave a Comment