Different query arguments based on from which page is post visited?

[ad_1]

Hi there, so I got single.php that is displaying single posts in some sort of modal in middle of the screen, behind that modal rest of the posts are loaded.

Now on the site I got front-page which is outputting all the posts and categories which is outputting posts associated with that category which is working fine. But I come across the problem when for example post is opened from category page, behind that modal on single.php all the posts are loaded like it’s is visited from the front-page.

I wonder if there is a way to run different query arguments in single.php based on from which link post is visited. If the post is visited from category page I want to query post behind that modal from that category, if it’s visited from the front-page I want it to query posts behind modal like it’s from front-page?

Anyone done something like this?

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer