It may indeed be simple, but without seeing your code, it is unlikely you will get any help. Try posting the code in the pastebin, and posting a link to it here.
Here is index.php: http://wordpress.pastebin.com/TeJhZGin
Please let me know if anyone wants any other code.
I don’t see anything obvious, but I suspect a problem with the permalinks. Try to switch to the default permalinks and see if the problem goes away.
No, it’s not that. I’ve left them at default so you can see.
The only other thing I can suggest is to verify that you are in fact executing the files you think you are.
I like to put an HTML comment in my php files so I know for sure which one is getting called. Something like this:
<!-- single.php --><div id="container">
Then I can look at the source of a page and see the comment.
If this does not give any leads, I am out of ideas.
I’ve done this (I’ve put <!-- single.php --> just before <div id="container"> in single.php and put <!-- archive.php --> just before <div id="container"> in archive.php) and they show up where you’d expect them to.
And I put the pretty permalinks back.
One last try and I’m done. It seems that single.php is getting called correctly, but with the wrong query. If the unmodified theme works this way, it is probably due to coding in the theme or possibly a corrupted WP install.
If the default theme displays single posts correctly, look for something in the theme. Otherwise, try a fresh install of WP.
It works fine with the default theme and I’ve just done a re-install and it hasn’t changed anything.
So I must have made a mistake with this theme. Is there any other file that could cause this to happen other than index.php, single.php or archive.php ?
Did you start with a free theme? If so, post the name and I will try to load it into my test site to see if I can spot the problem.
No this theme I’ve cobbled together from what you’re left with when you’ve gone through this tutorial http://www.wpdesigner.com/2007/02/19/so-you-want-to-create-wordpress-themes-huh/ which is pretty bare bones.
I’ve used this on several websites – I’ve just been comparing the single.php with another site I’ve done which works and they’re exactly the same.
Thanks for offering though. I can zip this theme up and put it somewhere if you’re interested?
OK. I might need to look at the theme, but first, lets do a little debugging. Add the print_r line below into your single.php and lets take a look at the query request that is created. Please run this and post the query that it shows.
<div id="container">
<?php print_r($wp_query->request); ?>
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 5
thanks
All right, the query is indeed not correct. There should be a clause in there like ‘AND wp_posts.ID = 74’ to select only a single post.
You could have something in functions.php, or a plugin that is changing the query.
I would first try disabling all plugins. If that does not work, please post functions.php in the pastbin and I will take a look.
I had already tried the plugins and the problem remains. It’s only Headspace 2, Google Sitemap Generator and Contact Form 7. The functions.php is only:
<?php
if ( function_exists('register_sidebar') )
register_sidebar();
?>
I have tried the homepage to be latest blog posts rather than static front page and the problem still persists.
I could have done something really stupid in the back end. Please bear in mind I’m really not very bright.