0

is it possible to track the route that the user took to get to a page ?

say that i have a post that have 2 different taxonomies taxonomy 1 = make taxonomy 2 = color

i want to create a different layout for each route

this is my current hierarchy:

Mercedes -> blue     -> car - the user gets template 1 (single-car.php)
blue     -> Mercedes -> car - the user gets template 1 (single-car.php)

this is what i want

Mercedes -> blue     -> car - the user will get template 1 (single-car_by_make.php)
blue     -> Mercedes -> car - the user will get template 2 (single-car_by_color.php)

is that possible without using extra query-strings ?

lior r
  • 2,220
  • 7
  • 43
  • 80

1 Answers1

0

I am not writing actual code. But I just giving idea how to do it.

use the the following logic in the your single-car.php file

if(taxonomy == make ) get_template_part( 'single-car_by_make' );

if(taxonomy == color) get_template_part( 'single-car_by_color' );

I hope It will help you.

Datta Parad
  • 709
  • 3
  • 11