Need A Quick CSS Override On Just One Page Via JavaScript?

Found this to work really well for a WordPress custom theme where the only option I had was to drop an override via a header/footer plugin option: [sourcecode] <script> var ref= window.location.pathname; var search="/youruniquepagelink/"; if (ref.indexOf(search) > -1) { let myElements = document.querySelectorAll(".your-class"); for (let i = 0; i <…

Found this to work really well for a WordPress custom theme where the only option I had was to drop an override via a header/footer plugin option:

[sourcecode]
<script>
var ref= window.location.pathname;
var search="/youruniquepagelink/";
if (ref.indexOf(search) > -1) {
let myElements = document.querySelectorAll(".your-class");
for (let i = 0; i < myElements.length; i++) {
myElements[i].style.display = "none";
}
}
</script>
[/sourcecode]

+ , , ,

Discover more from @JaredMeredith

Subscribe now to keep reading and get access to the full archive.

Continue reading