Title: single.php showing multiple posts
Last modified: August 19, 2016

---

# single.php showing multiple posts

 *  [nrrskwn](https://wordpress.org/support/users/nrrskwn/)
 * (@nrrskwn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/singlephp-showing-multiple-posts-1/)
 * I have made a 2 custom themes with the same codex, loop, php code etc. However,
   one theme’s single.php does not work correctly. When a single post is called,
   the single.php displays multiple posts.
 * the code i’ve used is the same in another theme and that theme has no problems.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [datasoftict](https://wordpress.org/support/users/datasoftict/)
 * (@datasoftict)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/singlephp-showing-multiple-posts-1/#post-1882452)
 * This is a very broad subject, but if you are saying that you have used a theme
   on one WP installation and it works, and the same theme on a second independent
   WP installation and it doesn’t work, without any changes to the code, then how
   you read your incoming data would appear to be the issue.
 * Are you sure that there is no issue with the single page? Sometimes the code 
   may be the same, but has a built in the error as often only one set of testing
   data is used.
 * Check the theme source, and try testing with the [WP test data](http://codex.wordpress.org/Theme_Unit_Test)
 *  Thread Starter [nrrskwn](https://wordpress.org/support/users/nrrskwn/)
 * (@nrrskwn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/singlephp-showing-multiple-posts-1/#post-1882718)
 * Thanks data for your response.
 * I created two similar themes which differ in aesthetics but contain the same 
   codex. However, one theme does not function correctly when opening a single page
   and a page. I am using it on one WP installation.
 * Would you mind elaborating on “a built in the error as often only one set of 
   testing data is used.”
 * I’ve searched through out the forumn/internet to find a solution and nothing 
   has really helped so far. I have yet to try the WP test data and will do that
   asap. If you have any other recommendations i would appreciate it.
 * Once again thanks for responding!
 *  [datasoftict](https://wordpress.org/support/users/datasoftict/)
 * (@datasoftict)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/singlephp-showing-multiple-posts-1/#post-1882737)
 * > Would you mind elaborating on “a built in the error as often only one set of
   > testing data is used.”
 * As I read the initial post I thought you had two different installations of WP
   running the same software, that is two identical themes on two web sites. I have
   found that when we take on older sites the code is often built to make the data
   that is already there work. For example what happens if A and B are passed to
   the code, the test model has A nd B so it works, but sometimes in the real world
   you can get A nd C passed to the code and it either fails, or more often comes
   up with some strange results. As I was wrong in my assumption and you are using
   exactly the same data it is a redundant remark.
 * Is it possible to let me have a URL so I can see the two different results? As
   this is your own code it is impossible to say look at line xx or the function
   Y isn’t working as could be the case in a more common theme such as twentyten(
   do you get the same problem if you switch to twentyten?).
 * To get the test data do a ‘Save As’ while hovering over the hyperlink and save
   the file off. _**Don’t do this on a live server as it will blow your current 
   database to bits!**_ Use the admin menu > tools > import to import it.
 * It would seem that if you have one set of data, and one set of code then it is
   how the code interprets that data that is the issue. Most single pages still 
   run a loop so I would start around the `<?php if ( have_posts() ) while ( have_posts()):
   the_post(); ?>` part of the single. You seem to be saying that the while loop
   stops after the one post has been loaded with one setup and not with the other.
 * These are the test criteria I would start with when trying to figure out what
   have I got and how could I have logically got them:-
    Does the broken theme always
   start with the same post ID as the working one? Does the broken theme always 
   start at the first post and run up to the correct one? Does the broken theme 
   get the one correct post and a random selection of other posts that change if
   you refresh the site?
 * Building up a picture of what is wrong will often give you that flash of inspiration!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘single.php showing multiple posts’ is closed to new replies.

## Tags

 * [multiple](https://wordpress.org/support/topic-tag/multiple/)
 * [single](https://wordpress.org/support/topic-tag/single/)
 * [single.php](https://wordpress.org/support/topic-tag/single-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [datasoftict](https://wordpress.org/support/users/datasoftict/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/singlephp-showing-multiple-posts-1/#post-1882737)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
