0

Is it possible to implement a different stylesheet for a page using a url variable, for example

Normal URL: www.example.com/page

Would use the normal stylesheet

Alternative URL: www.example.com/page?=alt

Would use an alternative stylesheet

1

if the url is www.example.com/page?style=alt, you can conditionally check the presence of $_GET['style'] when you're including your styles. Add the following where you are enqueueing your syles(probably in functions.php):

if(isset($_GET['style']) && $_GET['style']=='alt'){
  wp_enqueue_script('alternate_style);
else{
  wp_enqueue_script('normal_style);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.