Different single.php based on previous page
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
- The topic ‘Different single.php based on previous page’ is closed to new replies.