Title: Different single.php based on previous page
Last modified: August 20, 2016

---

# Different single.php based on previous page

 *  [nubijoe](https://wordpress.org/support/users/nubijoe/)
 * (@nubijoe)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/different-singlephp-based-on-previous-page/)
 * Hi everyone,
 * To start out with, I have to point out that I am a novice when it comes to both
   php and wordpress. Nevertheless, I am trying to create my own wordpress site,
   with my own theme.
 * In my menu I have several buttons. Two of them are called “Archive” and “Shops”.
    - “Archive” links to archive.php and displays the picture-attachment of all 
      posts within the “shops” category. These picture then links to the specific
      post.
    - “Shops” links to page-shop.php and displays all the child categories under
      the “shops” category. Pressing one of these child-categories will then display
      the picture-attachment of all posts within this child category through category.
      php. These pictures then links to the specific post.
 * So far so good.. this all works out fine.
 * The issue I am having is that when I go to a post through “Archive” and “Shops”
   I want the single.php to behave differently accordingly.
 * When I enter a post through the archive.php, I want to be able to go back and
   forward trough the **all the posts within the “shops” parent category**.
 * On the other hand, when I go to a post through the page-shop.php -> category.
   php, I only want to go back and forward between the **posts within the specific
   child category**
 * I hope this all make sense. I’m am looking for some smart way of doing this. 
   With my very limited knowledge on both php and wordpress, I was thinking if I
   could somehow create a variable on category.php that would tell single.php to
   act another way than if it is done through archive.php ?
 * Thanks in advance

Viewing 1 replies (of 1 total)

 *  Thread Starter [nubijoe](https://wordpress.org/support/users/nubijoe/)
 * (@nubijoe)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/different-singlephp-based-on-previous-page/#post-2209181)
 * Anyone who can help?
 * _[[please don’t bump](http://codex.wordpress.org/Forum_Welcome#No_Bumping)]_

Viewing 1 replies (of 1 total)

The topic ‘Different single.php based on previous page’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [nubijoe](https://wordpress.org/support/users/nubijoe/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/different-singlephp-based-on-previous-page/#post-2209181)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
