Wordpress Custom Theme Concepts

Posted on 2014-01-16
Last Modified: 2014-01-18
I've decided to start doing my sites in Wordpress because more and more clients are asking for a CMS to edit their site.  It seems like a good fit - and it's easy to install and use, so - why not.

As I'm trying to take the next step and create a custom theme, including a home.php page that mimics my site, I'm struggling to come up with the best way to do it.

I include get_header(), get_sidebar(), and get_footer() in the home.php file, including all my text and images from the original design.

This particular page has a few paragraphs on it - and Ideally it would be great if the users could change this without needing to access home.php.   Is this possible?  The page doesn't show up in "pages" in Wordpress' back end - (and I'm sure missing whatever code would be needed anyway (on home.php) to take a value from the database.)

Also, the right column (side_bar) is kind of similar throughout the entire site with 2 or 3 sections: a block quote, an area for quick facts, and all pages except the home page also have a quick contact form.

Since I want the block quotes and quick facts to be different on each page (user input) I was wondering if custom fields were the best way to do this, or if there was a better way.

Hope this isn't too confusing of a question.  Thanks for the help!
Question by:slightlyoff
  • 2
  • 2
LVL 38

Expert Comment

by:Tom Beck
ID: 39785662
In WordPress, it's common to generate all content via posts. The key mechanism is "The Loop" as described here:

To restrict which posts appear on which page of the site you can compose your content in posts and then divide your posts into categories. Then in the php file for the page you want to fill with content, restrict the Loop to only those posts from a certain category like this:

<?php query_posts('cat=2'); ?>

In addition to your custom home.php page you may want to create other custom pages to display different posts as content. Creating custom pages is easy, just clone the home.php page, rename it, and place the required template info at the top. Doing this causes the template to appear in the drop down list of templates when creating new pages in the Dashboard. An example of what to place at the top of a template page:

 * Template Name: About Page Template
 * Description: About page template.

The words "About Page Template" will appear in the drop down for you to select when you create an About page for example.

Keep all templates including the custom home.php in the child theme folder.

Author Comment

ID: 39785713

Just to clarify - I'd create a page called homepage content, put it in a category and in my home.php file I'd limit the query_posts inside The Loop to the category that has the homepage content in it.  Right?

Thanks for the quick reply!
LVL 38

Accepted Solution

Tom Beck earned 400 total points
ID: 39785995
Set up your WP file structure like this if you have not already:

<root>/wp-content/themes/<parent theme>
    --> original home.php
    --> original functions.php
    --> original styles.css
    --> etc, etc,

<root>/wp-content/themes/<child theme>
    --> cloned, customized home.php
    --> cloned, customized functions.php (if needed)
    --> cloned, customized styles.css (if you want to tweak the original theme)
    --> <page template 1 name>.php (these can be clones of home.php to start with)
    --> <page template 2 name>.php
    --> <page template 2 name>.php
    --> etc, etc.

Be sure to name each template in the comment area at the top of the php file.

You can use the cloned home.php as your customized home page or rename it homepage.php or whatever. You can designate any page as the home page.

It's important to set up the file structure this way because you will inevitably have to reinstall WordPress somewhere down the line. By keeping all of the customized files in one place, you can back that up and reinstall WP without worry. Never alter original WP files.

Now, from the WP Dashboard, create categories for posts. A category corresponding to each page name.

Create new post(s) for the content you want to appear on each page and be sure to check the appropriate post category that corresponds to the page name.

On your <page template 2 name>.php files add the <?php query_posts('cat=2'); ?> to the code where appropriate to add only the posts associated with that page.
LVL 70

Assisted Solution

by:Jason C. Levine
Jason C. Levine earned 100 total points
ID: 39787364

Please read this WordPress Codex entry on Template Hierarchy

Basically, you want to create custom templates and then match them up to something (read the article see the definition of "something") like the post ID or slug and then use custom fields to control any variable content.

Author Closing Comment

ID: 39791279
Thanks for your help - I think I'm getting the hang of it.  I'm posting another question about best practices - and would love your feed back.

Thanks again!

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress type image upload 10 45
remove border from element 5 77
Having multiple API's on a site 10 39
WordPress Header Issue 9 46
I want to start by talking about the use of plug-ins for WordPress. I started a web-site for a company I was working for a few years ago; I had extremely basic knowledge of HTML. I am a Graphic Designer by trade so I invited the opportunity as a cha…
What's this? As a volunteer Page Editor for, I have noticed that many authors also have blogs, and pull articles from their blogs to post at Experts-Exchange. I appreciate each author sharing their blog content with our site …
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question