I'm trying to create a little php function, which if a cookie exists, then use the css styles, else if it does not exist use these.
I'm using the code below, but it is using the if styles regardless if the cookie exists or not.
What am i doing wrong?
<?php if ( isset($_COOKIE['CookieLawInfoConsent']) ) : ?>
<style>
html.has-not-scrolled #desktop-header { top: 0px; }
#mobile-header { top: 0px; }
main {top: 0px;}
</style>
<?php else : ?>
<style>
@media all and (min-width: 1201px) and (max-width: 1235px) {
html.has-not-scrolled #desktop-header { top: 80px; }
#mobile-header { top: 80px; }
main {top: 80px;
}
</style>
<?php endif; ?>