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
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityIs 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
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);
}