Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front-page.php issue #100

Closed
r3df opened this issue Jul 27, 2011 · 8 comments
Closed

front-page.php issue #100

r3df opened this issue Jul 27, 2011 · 8 comments
Assignees

Comments

@r3df
Copy link

r3df commented Jul 27, 2011

I'm unclear as to the intent of front-page.php, and if there is actually a "bug" in that does not function as intended. The doc's state:

"front-page.php is the default template for the Home page. If you change your site
Reading Settings to show your latest posts instead of a static page, then index.php
is the file that you'll want to edit for your homepage."

Which to me implies that if you set your front page to "static page" front-page-php will be used and index.php will be used if you set your front page to be "latest posts".

However, that is not what happens, regardless of your Reading Settings, front-page.php is always used. This is as expected as per the the template hierarchy chart (http://codex.wordpress.org/Template_Hierarchy). To have a front page that is a "static page" use page.php, and to have a front page that is "latest posts" use index,php, you actually don't need to do anything, that is the default. Adding front-page.php overrides both cases.

Since front-page.php is just a copy of page.php, (missing 2 action hooks, is that intended?) would it not make sense to do away with front-page.php which would then have the intended result as documented? Right now front-page.php is not well suited to the display of "latest posts" as a front page, but that is what is used.

@ghost ghost assigned retlehs Jul 27, 2011
@retlehs
Copy link
Sponsor Member

retlehs commented Jul 30, 2011

updated the wiki to document how you should deal with this for now, although i'm open to suggestions on how we change this moving forward

During Theme Activation we create a page called Home and set it to be the static frontpage in the Reading Settings. front-page.php is the default template for the Home page. If you change your Reading Settings to show your latest posts instead of a static page, then you'll first want to delete front-page.php and then index.php will be used for your homepage.

the missing action hooks were not intended, thanks for pointing that out :) fixed with cd297c2

one solution is to change front-page.php to page-home.php, which i actually used in roots for a long time.. but pretty much every site i've made has had a static frontpage rather than showing the latest posts. i've realized since releasing roots that there's a lot of different ways people are using it, and we could accomodate this better for sure.

@r3df
Copy link
Author

r3df commented Aug 6, 2011

Now I really think that front-page.php is redundant.

With the action hooks added to front-page.php, page.php and front-page.php are identical. In my testing on my dev site, anytime that front-page.php would be invoked, page.php is used if front-page.php is not there, so it seems to me an identical front-page.php serves no purpose at all. You don't need it for a static frontpage, page.php will be used if you set WP to have a static frontpage. You only need front-page.php if you truely want something completely different than the rest of the pages for your front page.

My suggestion is to remove it and I believe everything would be simpler. The theme would just work no matter whether you set a static page or latest posts for front page, no messing about deleting or moving files required.

@retlehs
Copy link
Sponsor Member

retlehs commented Aug 6, 2011

You only need front-page.php if you truely want something completely different than the rest of the pages for your front page.

that has been the case for every site i've made in wordpress, which is why it's currently there :/ (i'm not saying that's a reason to keep it, just pointing that out)

@coreywagehoft
Copy link
Contributor

I use front-page.php for every site I have built on roots. I have never built a site either where the front page is like the rest. I think the way it is used now is just fine.

@r3df
Copy link
Author

r3df commented Aug 11, 2011

I too use a CUSTOM front-page for many sites, including the one I'm currently building with Roots. That's the point, it is custom. You create it by copying something else or creating your own from scratch. The current front page is an exact duplicate of the default page.php, and it complicates using Roots out of the box, you can't have a blog as the front page for your site, as that does not work with this front-page.

Removing front-page.php would not change the majority of the intended functionality of the theme. Unless I've missed something, the only thing that changes is that to have a custom front page you would need to create your custom front-page.php, probably starting by copying page.php, which is something you need to do anyways to have a custom front page.

@r3df r3df closed this as completed Aug 11, 2011
@retlehs
Copy link
Sponsor Member

retlehs commented Aug 11, 2011

i don't see how it complicates roots out of the box considering most people using roots are making static frontpage websites rather than having an index with blog posts. the way it's setup right now you are able to immediately jump in and edit your custom frontpage without having to create the file and set it as the static frontpage.

if you'd like to use an index with blog posts you can follow the simple instructions i've added to the docs.

you're suggesting that we just delete front-page.php, but that actually complicates things for me and most other people using roots..

@r3df
Copy link
Author

r3df commented Aug 17, 2011

Oops, I see that I closed this, didn't intend that! Going to have to watch those submit buttons more carefully.

When I said it would be more complicated I had been trying to think of a new WordPress user trying to use the theme, and using it with either posts or static front page. If front-page.php was not there, and you changed nothing else, the theme would work exactly as it does now, out of the box what you see in the browser would be identical. The only difference would be needing to copy page.php to front-page.php if you need an actual custom front page different from regular pages. Without front-page.php, if you wanted a posts front page, all you would need to do is change the one switch in reading settings and it would work too. Simple for somebody new to WordPress.

Completing my line of reasoning, was that if a user is creating a custom front-page.php, they must know a bit more than your average novice user, or at least they need to have done some reading, and there is lots of documentation on adding a front page as that is the common WordPress path, thus doing the file copy should be in their capability.

Another case is when using Roots as a parent theme, which seems to be gaining popularity. If you don't want a custom front page in your child theme, you need to do to a chunk of coding to override/work-around the front-page.php, duplicating WordPress functionality. Deleting the file in Roots as a parent theme defeats the point of a child/parent theme set-up as you've now altered the parent theme directly.

Are you still thinking of initialization options? Perhaps copying page.php to front-page.php during set-up could be done if "custom front page" is selected as an option? You could even have it selected by default, but that way if you don't want it, you un-check that option and you don't have to worry about it anymore on updates. and if you do have a custom front-page.php it won't get overwritten id you do an update, 'cause it's not in the source.

@retlehs
Copy link
Sponsor Member

retlehs commented Aug 17, 2011

Are you still thinking of initialization options? Perhaps copying page.php to front-page.php during set-up could be done if "custom front page" is selected as an option? You could even have it selected by default, but that way if you don't want it, you un-check that option and you don't have to worry about it anymore on updates. and if you do have a custom front-page.php it won't get overwritten id you do an update, 'cause it's not in the source.

i like this.

oxyc pushed a commit to generoi/sage that referenced this issue May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants