I wanted to start a series here on my blog to help both myself and other theme designers. This is the “If you were a WordPress theme developer” series, which means that I will be asking various questions to get into the mindset of users.
Typically, I know what I want to add to themes, what makes theme valuable. But, I sometimes wonder what exactly users are looking for, what would add value for them.
So, you, the users, will get to be theme developers for a bit.
What this series is about
In the upcoming posts, I want for us all to pretend a few things. The imaginary theme we will be creating is a very basic template — no bells and whistles here. You’ll eventually want to modify it to suit your blog’s needs, but we’ll get to that later.
The idea behind this is that we want to make the very best theme possible without sacrificing coding standards and making a complete mess. This theme will be the base of your new WordPress-powered blog. What you want is a solid theme to build from.
I want you to think about the functionality of your theme and the content of your blog. It doesn’t matter if you want to run a family blog or a fully-featured site with 20+ authors. It’s the foundation that matters.
Page templates
In this first post, I want to cover a topic that’s been on my mind lately: what page templates should be added to a theme?
For those of you unaware of what page templates are, the WordPress Codex explains how they work.
Basically, page templates let you change the design and/or functionality of particular pages by using a special template. If your theme comes with extra templates, you can simply scroll down in your Write Page admin panel and select the template you want for that page. Everything defaults to the default template, which is page.php in your theme.
What page templates should be included in themes?
Some page templates that are really easy to make and add a little extra are:
- Archives (listing your archives and support for plugins)
- Authors (showing a list of all authors and biographical info)
- Blog (for a separate blog page)
- Bookmarks/Links (lists your bookmarks/links to other sites)
- No Sidebar (for pages that need a little extra room)
Those are just a few ideas. What I don’t like to do is make pages that list posts from particular categories — that’s what your category archives are for! For some reason, this is one the most-requested page templates, which is usually just from a lack knowledge about how WordPress works.
Some page templates could incorporate popular plugins. Others, well…I’ll let you decide.
Think about what your basic needs are for running a site, what would really benefit your content.
Okay, right place, right person and the right right time
I am playing with themes now, and trying to learn more about
and as you know, concentrating on child themes as first step before making an actual theme .. so, Justin, you be my Guru
Tag Cloud — A page to display your full Tag Cloud, not just the popular ones that are displayed in the sidebar widgets.
404 — With things like search and archives already built in, which would just leave some personalisation to add. The 404 page gets ignored by so many people because usually it will mean delving into code, whereas a template would mean people could work on it easier.
Would need a way to be able to exclude, especially 404, pages from main navigation.
I think the concept of page templates is very powerful.
Recently a client of mine asked for something unique that relates to this conversation.
The client wanted…
- “news style” look for the “front page” of the blog
- “no sidebar” for pages (to make it appear like a regular website)
- “blog layout” for everything else
I was scratching my head as to how this would be done but after working with another designer, we immediately decided to use page templates.
The results were great and the client was VERY excited because there was no serious “hacking” involved – it was just a selection from the page template menu.
So I think one of the biggest benefits of page templates is that it gives you the ability to control the look of different parts of your site/blog very quickly and easily without the need to do extensive tweaking of the code.
Great tip Justin!
The first thing that pops into my mind now is a page that dynamically displays a list of a certain media type that has been published in the blog posts so far. For example a list of all audio files / images – slidehows / videos.
It is a bit like the possibility the NextGen plugin offers to show an album of several galleries that were published.
My rule of thumb is this —
As far as “Page Templates” go (not the standard template files), give the user a default page template, a “blog index” template, and page templates with sidebar options (no sidebar, sidebar-left, sidebar-right, etc.).
Past that, it’s really all about what the theme calls for.
The “Authors” page is actually a really cool idea. I hadn’t thought of it before, but I can see how it would be useful to a multi-author blog owner.
Cool stuff man!
Here’s my two cents…
404 Page Templates – A choice of 404s to choose from, or at least some customization included that has links to related posts, recent posts, other suggestions for exploring the site, maybe an included form that suggest sending the author a quick note that says “I couldn’t find what I was looking for, maybe you can point me there, or do a post about what I need to know”, etc….
Sidebar or Sidebar Removed Page Template – I have created my own page templates on numerous occasions to remove the sidebar that would allow me the full width of the theme to work with. This is really useful for embedded full sized media like photos and videos without being constrained to the normal width or the content box.
Thumbnail Gallery from First Image in Post – For me, this would be a very useful template. A page that would display a configurable number of rows and columns that would automatically pull the first image it finds in a post and maybe the title and excerpt, and display those as a thumbnail gallery.
Thanks for the feedback so far, everyone.
dinu
Once you get to learning your way around WordPress a bit more, then you’ll definitely want to try out different forms of page templates.
Paul
The tag cloud could be a pretty cool template. I wonder if there are any plugins that could also be incorporated if the user has them installed.
The 404 template is actually something different than a page template, which I’ll delve into later in this series.
Stu McLaren
With a little creativity, just about anything can be done. Page templates are very good when working on client projects because you want it to be very easy for them to change things without touching code.
cubus
Are you talking about showing every single attachment on one page? Or, separate pages for each type of file?
One thing I have noticed is that not all media types are what we think they are. For example,
.flvfiles aren’t video files. They actually have a mime type ofapplication/octet-stream.I’d like to hear more about your idea though.
Nathan
Thanks for the input. The sidebar options are really great. I’ve been using the No Sidebar template with one of my themes for a while, and a lot of users really love it.
Also, I just followed your tutorial on making a blog template, which was much better than what I had before.
IndieLab
The 404 template actually isn’t a page template as I mentioned to Paul. I will definitely be covering it later though.
Could you elaborate a bit more on the Thumbnail Gallery? Are you talking about pulling images from many posts to make a gallery or only pulling the latest post with a gallery?
If I were a WordPress template designer (and I’m not), here are the things I would offer:
1. Optional number of sidebar blocks – either no sidebar or the ability to have as many blocks as necessary.
2. Ability to decide on maximum font size in Tag Cloud. When I went from Blogger to WordPress and transferred all of my archived posts, it caused a big enough problem with the Tag Cloud that I disabled it.
There are more, but these are the two items that give me the most headaches. Thanks.
Irene King
Thanks for the input. In this post, we’re just discussing page templates, and I’d love to hear what page templates you think should be added. I’ll cover other areas of themes in later posts.
Great idea, Justin. I think it’d be cool if after each one of these posts you did a follow post a week or two later summarizing what you found from the comments.
Hello Justin, I was thinking about separate pages for each “media type” indeed. Something to create like an archive for multi-media files once added to your blog separated from their posts.
Too bad the default Wordpress media uploader doesn’t allow to add tags to all the uploaded files. They could make an easy filter to use on such a page. Because some kind of filtering should be necessary I guess.
@Justin — I use the Configurable Tag Cloud widget for the tag cloud in my sidebar. It would be really good if that could be incorporated into a tagcloud template page. The theme I’m using currently, Mandigo, does have a tagloud page template, but I needed to make some alterations to it to get it to display all of my tags, and not just the 45 set normally by WordPress, and to limit their size a little.
I didn’t realize the 404 template was a different beastie. I shall look forward to seeing what you say when you cover it — I’m sure I could do so much better with mine.
Dan
That might be a good idea. I’ll see how much feedback I get from the next few posts. If it’s looking good, I’ll try to post some kind of analysis of everything.
cubus
It’s definitely an interesting idea. Thanks for elaborating on it a bit more. I wonder how many different media types there are…
Paul
I’ll bookmark that plugin to see what’s possible. I’ll also search around for some other tag cloud plugins to see if they could be supported by the theme.
The 404 template post is coming up soon. I’m really a lot more interested in what you have to say though.
Obviously ones page template should match the site itself. Adding customizations to different templates for slight variations in presentation is a good idea.
I need to try and incorporate more pages into my Wordpress Blog so I look forward to further discussions.
Cheers,
Jeromy
For me, basic template should do…
Beside index.php, I’ll make other template file as single.php and page.php only…
If the theme have a magazine type homepage, I’ll include a blog.php template file.
I am using
query_posts('showposts=10');as a section if the particular theme have magazine type homepage…But, it seems not the right way even it’s works…
I wonder how you all do it?
@Justin,
Yes, I was talking about pulling the first image of all posts and then displaying them in a thumbnail gallery fashion including the permalink and maybe an excerpt. You can see something similar HERE , although this is pulling blog avatars and displaying the blog name as a link.
So, what I am suggesting is that in my theme, I create a page, choose the “posts with images gallery” page template, and that template auto-generates a thumbnail gallery of all posts that have images. The thumbnail that it uses is whatever image is first in the post.
Oh, and I suppose it would have to auto-resize the thumbs too.
Additionaly, maybe this could work hand in hand with cubus’s suggestion and different media types could each have their own template?
Hey, you asked, I know it won’t be simple;)
Hope you had a safe trip back to the states, don’t forget to vote next month!
@IndieLab — I think that would be a good addition to a theme, a page displaying thumbnails of the first image from posts. I would certainly use something like that on my blog.
I was pleased to find this post I just did a post the other day promoting the use of templates and was having a hard time actually finding someone other than me promoting them, much less using them.
Jeromy
Most page templates should be made by the site administrator because each site will be a bit different and will require different functions. Definitely play around with pages a bit more. I’ve always thought they were immensely more powerful than posts because of the page template system.
Pangeran
While
index.php,single.php, andpage.phpare all templates, they’re not page templates.blog.phpis getting to be a more common type of page template though, especially with the different types of home pages being set up.IndieLab
Thanks for the clarification. I could definitely see something like that as feasible. Plus, WordPress auto-resizes the thumbnails for us, so there’s no need for any fancy coding there. I’ve been playing around a lot with attachments lately, so I’ll probably add this to the list at some point. The only problem I can foresee is the strain on the database if you’re pulling more than 20 or so posts and the attachments for those posts.
Brad
I use page templates when they’re needed, but only when I can’t get the same functionality out of the default
page.php. A lot of this comes from my days back when I first started experimenting with WordPress and didn’t completely trust the system to do what I wanted. So, page templates were my friends for quite some time.I always seem to use contact and sitemap for pages. I seem to do them by hand every time, but it would be nice if they could be included as a template. Though, this might only be a plugin with the op called on the page.. and that is how I do them by hand.
I don’t know if you would consider that overkill or not (or even the type of input you are looking for?). It would kind of remind me of archives.. I am only going to use that template once, but it would stop the redundancy and make it easier to do with each site I make.
The contact page has always come up, but the Easy Contact plugin makes that pretty much useless now.
I’m definitely looking into some different site map solutions though.
Hi, An interesting debate, but I think we’re all thinking far too much about how things should look – and not so much about how they function. For example, I would use with much happiness a template which only allowed logged in users to show that page, displaying some other content instead if user is logged out. It would be great if links didn’t appear if the page they linked to was unavailable to the current user – but perhaps that is too specific. Another example would be to have pop up DIVs, which were not displayed to logged in users. I prefer to use the Widget Logic plugin than page templates to control what widgets go wear… but I would like a no sidebar template, any ideas how i could do that – I’ve not actually made any of my own templates yet! (using mandigo theme).
Good luck all.
Andrew
You’ve just thought of my next page template — the logged-in page template. That’s a great idea.
I do agree that page templates should be more about function than form though. The whole idea for me is about getting as much information to the user in an easy-to-implement way.
If you’re interested in checking out a No Sidebar template, there’s one included in my Options theme. Of course, I work with widgets and sidebars in a much different way than many other theme authors. In a lot of themes, you could probably just copy
page.php, turn it into another template, and remove the call to the sidebar.Just added an extra little bit to my Logged In template for my next theme — the ability to choose this by capabilities (through custom fields).
I’m getting ready to put a new site online in a couple of weeks and am truly enjoying this series.
The problem I had when switching from Blogger to WordPress was the problem of the Archive posts from way back. Because there are so many, they made the Archives item in my Tag Cloud just horrendously large, and I discovered that there was no way (at least no way I could figure out) how to control the sizes of the fonts in the cloud. I wish someone could come up with a way to do that withing a theme.
Oops. I just realized that I wrote about Tag Cloud once already. Sorry. What I’d really like in a template is the ability to put widgets just about anywhere, not just a sidebar. Perhaps a template made up of blocks of sidebar code where widgets could be placed. (Hey! since I’m dreamin’….)
oh, maybe my post in the widget-discussion would fit better at this place. so because we are acting in social media I would love a page-template “social media newsroom”, that helps me to include the sections like Shift Communications proposes: http://www.shiftcomm.com/downloads/smnewsroom_template.pdf
Maybe it´s possible yet, but I didn´t because I don´t look through the whole functionality of wordpress
Hi
I have an issue with the page templates..
I have 4 menu links in the home page. these pages are loading differently styles pages. So I have created pages in word press admin with same page slugs. They are about, products, contacts, services. I also created the same 4 php files in my new themes named about.php, products.php, contacts.php and services.php
but when I load the pages the its shows only the page templates in the page.php
I am really stuck on this
Any help appreciated ..
Thanks in advance..
Irene King
In my next theme, there’ll be a page template that’s completely widgetized, so you can put whatever you want on the page.
Alex
Well, pretty much anything is possible with WordPress. I’m not sure what you’re pointing out in that PDF though. If you’re referring to the entire thing, then maybe you’re looking more for a theme and not a template.
joban
You can get help with WordPress issues at my support forums or the WP.org forums.
This is a question I asked to another great designer! I am curious about your feedback on this Justin!
We could say that blogs are maybe 90% posts and 10% pages. We could play with these stats for a while but it would not change anything important. We know that Wp is used mainly for publishing posts and not pages.
In that case the logical question is: why creators of WP themes offers pages templates sometimes but never post templates?
Having a theme that offers 15 pages templates is very good, but why is it so hard to find post templates also?
The bottom line question is this: where is the logic behind that if pages are the exceptions and posts the rules?
Give me the light Justin!
Thanks
Roger
Roger, it’s a question many people have asked, but it’s the wrong question. See, you can have post templates. It’s not really all that hard.
So, the question should be, “How do you create post templates?”
The major problem is how to go about implementing them. Should they be implemented the same as page templates? Should we create them by tag? Category? On a post-by-post basis?
Think about the functionality of pages and posts for a moment. Pages templates are set out to do a specific task many times. Posts are almost always the same. Pages can be vastly different, but posts are more general, only needing to look and feel the same as all other posts in most cases.
You talk about creating post templates, but you don’t talk about what you would actually do with them. What would be the purpose of having a post template? Given an example. Pretend you have one extra post template. How would you use it? When would you use it?
Answering those questions is more vital than the why you don’t see post templates in themes.
First thanks for the answer!
Pages, with template or not, can clogg your blog! I will give you a concrete example! If you go my web site at: http://ponics.org/urban-gardening-mindmap/ you will see an example of a
post template without the sidebar. Mindmaps need room!!!
Over time, I will create dozens of these mindmaps. If you have a blog with a “normal” navbar, where would you put dozens of navigation page links, unless you have a theme that
“accepts” sub-page in the nav-bar?
If I am not wrong, pages dont even have categories unless you use some plug-in. Posts have them, very handy for many mindmaps in multiple categories.
The sidebar!
Sorry I hate that name! Widget box could be better…I think!
I am so fed up of seing that sidebar always on the same place, on the same side, pages after pages, posts a after post what a lost of space and creativity! (I have seen your work and
I am very aware that you are thinking “outside of the box”, specially since your last creation “Hybrid”).
By having post templates with different widgets boxes, user could place whatevercontent inside using all kind of widgets! Post template with a sidebar on the left, another one with one widget box on top, another one with a widget on the footer, one with all of the above, one like I have with no sideabar at all. And I am not talking here of one unique widget-box. Post templates would become just place holder, empty place holders that you could assign to any post, any tags, any categories you want!
Goal: to unfreezed that ice-sidebar bar! What would happen behind the scenes in terms of programming and design time frame to raise the bar to that level? This I can’t answer!
You said: ” Should they be implemented the same as page templates? Should we create them by tag? Category? On a post-by-post basis? “. A long journey starts by the first step!
That very first step to the post template journey, could be either by post, by tags or by cats, the important is that someone will dare to do it! But hopes are small! Why! You don’t know,even in 2008, how hard is to find templates, even pages templates, that don’t have a sidebar. So …post templates! ? Be my guess!
Again, maybe I am just a dreamer!
Roger Pilon
One would assume that you’d customize your page menu. I have over 100 pages both here on this site and at Theme Hybrid. Neither one is clogged up.
I fail to what the sidebar has to do with our theoretical post templates. You don’t need a post template to move a sidebar on a per-post basis or even get rid of it.
Then, you would only need one if they are empty placeholders. Therefore, no need of an additional post template at all.
Not a compelling reason to add them to generic themes. What I mean by “generic” is themes that are released publicly to a mass audience. The only reasoning I can see for post templates are for special design projects for clients that need a certain functionality on specific posts.
Most of the reasoning behind your want for post templates shouldn’t rely on post templates at all — that would be a bad way to go about doing those things. CSS is a very powerful tool, especially if you have a solid framework like the Hybrid theme.
I can do everything you asked with the Widget Logic plugin and CSS.
Again, I’m not convinced post templates should be added to themes. The ability for the user to create his or her own post templates would be cool though.
Post templates should be about functionality. Not form.
Why doesn’t aybody focus on the advertising? That’s the money part of it? And I’m talking about making it easy so that Google Ad Words can be cut out, with ads for image / video / rss / whatever and link tracking and built in merchant account recurring billing. It’s the most obvious thing.
I’m new to wordpress, currently configuring the Hybrid Old school theme.
What I really wish wordpress could be is a combination of the widget/page editor with the placement GUI of an igoogle homepage. It would allow drag and drop placement of page elements as widgets.
A theme would still exist for the graphical style of the website, but the layout of the site could be rearranged easily using a GUI. A grid website editor built upon a blogging engine I suppose.
Perhaps some form of that already exists in wordpress, and i just need to dig deeper O_o.
If i am a wp theme developer i wanna make a simply guest book page on it that icluded in the theme
Hi Justin,
How can we have a filename.php included in page.php which will only show up in the Home Page (static page) and for the rest it won’t.
Hope I was able to put my question in short.
Cheers
I’m little late (ok, a lot!), but, what about post types? is customizing the content-{post-type}.php enough? It isn’t working so far for me!