Static CSS with Dynamic Element ID
We can make dynamic CSS via PHP, but it’s a little bit complicated when just a very small modification is needed. The idea, static CSS with Dynamic element id, comes from when I am trying to render a sidebar in different pages in WordPress. I’d like to show it to you with a single line php code.
<div id="sidebar_left<?php if(is_category(array(23,49,50))) echo "_small"; ?>
In the CSS file have another rule called #sidebar_left_small {} It’s DONE!