Some template fixes
For a long while now, the meta data (posted date, number of comments, category, tags, etc.) have been missing from the posts index page at http://garyjones.co.uk/blog/ and I could explain why. I’d tried editing the “Main Index Template” plenty of times, but nothing was working.
I knew that WordPress had a number of fall-back templates, if certain files weren’t available, but wasn’t sure where to find this info, or how it could help.
My problem was two-fold: I’d got myself confused between the homepage of the site, and the homepage of the blog. Part of this template fall-back feature, is that WordPress checks for a {pagename}.php file before trying other templates. Unfortunately, I’d named the root homepage to home.php, but had set the Post Page to be Blog, but use this Home Page template to be the template of the Blog page! So confusing!
The solution was to have a read of the following, taken from the Template Hierarchy page, and then unscramble my file names, template names, assigned page templates, and the front page displays in the Reading Settings so that there was no confusion.
![]()
Once this was done, then I could add in the correct meta data to the correct template, while not adding it to the root homepage. I still need to fill in the big blank space however…
I also added in the Popularity Contest plugin code - this is a percentage value of how popular the page is, compared to the most popular page, based on a score from permalink views, homepage views, feed views, comments etc. As the original plugin gives a fatal error in WordPress 2.6, I used a hacked version which works perfectly.
Now I’ve got a better idea of how the templates work, I can sort out the development area sometime in the future, so that the templates in use there are less scrambled too!