Content conditionally displayed depending upon last page visited?
-
Hi – hope I’ve posted this in the correct forum?
I like to know if (and how) it is possible to conditionally display content on a page depending upon which page the user has come from within my site? (would this be by referrer?)
Or, as an alternative is it possible to pass a $variable from a link clicked on page ‘A’ into an variable within an expression on page ‘B’, thus making page B show content relating to page A?
I realise the simplest option would be to use a tag archive page, but that would break my navigation because the highlighted current page would no longer show up in my top and side nav bars as the visitor would have moved away from my page structure..
I’m building a site which has is using WordPress as a dynamic CMS. The site is still locally hosted in Mamp so I can’t yet show you, but I’ll try and describe the scenario.
I have four ‘product pages’ within the site each showcase one of four products. There is also a ‘reviews page’ containing a long list of customer reviews for all of the 4 products. These reviews are tagged with their own custom taxonomy to allow them to be sorted by product.
I’d like the ‘customer reviews’ page to show reviews for a certain product first (above the other reviews) if the visitor has previously been viewing the ‘product page’ for that specific product.
My initial thoughts are to somehow use the page referer info to trigger a conditional template tag, or to pass a specific taxonomy tag into a query. I don’t know if this is possible? Maybe an easier solution (again, no idea if its possible) would be to somehow pass a variable from a link clicked on the product page into a condition tag on the review page?
I’m new to wordpress and have learnt so much about wordpress and PHP in the past few weeks but this is beyond me. I’d really appreciate any help or pointers if this is doable.
Many thanks
Stef
- The topic ‘Content conditionally displayed depending upon last page visited?’ is closed to new replies.