Question

I have a home.php file which I am using as my home page and it is showing a specific page.

In my index.php I have my main timeline. But when I access this page I get redirected to home.php.

How can I do that? To show my main timeline in a differente path then home. Something like mysite.com/blog

Was it helpful?

Solution

Rename your home.php template file as front-page.php.

In WordPress parlance, "home" is the Blog Posts Index. The front page of the site is Front Page. Likewise, the home.php template file corresponds to the Blog Posts Index and the front-page.php template file corresponds to the Site Front Page, and the is_home() conditional returns true when on the Blog Posts Index while the is_front_page() conditional returns true when on the Site Front Page.

To summarize:

  • Site Front Page: Front Page, front-page.php, is_front_page()
  • Blog Posts Index: Home, home.php, is_home()

EDIT:

How to setup a static Page as Blog Posts Index:

  1. Create two static Pages, with any arbitrary names (we'll call them "Front Page" and "Blog")
  2. Go to: Dashboard -> Settings -> Reading
  3. Set "Front Page Displays" to "Static Page"
  4. Select "Front Page" in the dropdown for "Front page"
  5. Select "Blog" in the dropdown for "Posts page"

Now (assuming you have configured pretty permalinks at Dashboard -> Settings -> Permalinks):

  • Front Page URL: www.example.com
  • Blog Posts Index URL: www.example.com/blog/
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top