Best way to present options for home page in admin?

There are many solutions to this problem. And every one of them is correct, I guess. It depends on what you really want and what will be most friendly/clear to user/administrator of this page.

I usually use 3 ways to solve this. Which one of them I chose? It depends on situation. Sometimes I use 2 of them simultaneously.

1. Static front page solution.

When I can set static page as front page, I do it. Then create front-page.php page template and use it to define how home-page/front-page should look like.

To display/allow to edit some custom fields on this page, I use Advanced Custom Fields plugin. It allows you to define custom fields set for front-page (and much more). Then I use front-page.php template to show these custom fields values, where they should be shown.

If some of these values should be repeated on every page (in footer, in header, etc.) I get these values from Home Page like this:

$cf_value = get_post_meta( get_option('page_on_front'), '<CUSTOM FIELD NAME>', true );

It’s very easy and clean solution, when there are not many fields that should be repeated on other pages. It’s user friendly to, I guess. If you want to edit home page, you just have to go and do it – you can edit everything in home page editor.

2. Universal solution.

The other solution I use is to define some theme options. It is much better when you want to define look of page (logo image, backgrounds, and so on), and not only the content (especially if you mean the content of only one page).

I usually use OptionTree plugin to do this. But it’s not so hard to do this by yourself.

I don’t really like the idea, that you should edit content of the page in theme options, so I don’t use this solution very often.

3. When this content is always repeated on other pages

Sometimes you have to show some values on every page (or most of them) and not only on home page. Then the “nicest” solution, I think, is to define these areas as sidebars and allow user to edit them using widgets.

If this repeating content is just one line (copyright info line in footer, etc.) and it won’t be changed to often, I probably would use solution 1. But if it’s more complex or it will be changed often, this solution is best, I guess.

Leave a Comment