wordpress fix

by sirfizx

HTML

<body class="page-id-47">
    <div class="site-branding">	<a href="https://elhsworld.wordpress.com/" rel="home">
					<img src="http://kindersay.com/files/images/cow.png" width="900" height="300" alt="" class="custom-header">
				</a>

        	<h1 class="site-title"><a href="https://elhsworld.wordpress.com/" rel="home">ELHS Global Studies</a></h1>

        	<h2 class="site-description">"education is the most powerful weapon which you can use to change the world." Nelson Mandela</h2>

    </div>
    
    <body>

JavaScript

function hasClass(elem, className) {
    return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');
}

var url = '';

var pageIds = [47, 48, 49];
var imgURLs = ["http://www.pets4homes.co.uk/images/articles/834/large/should-you-put-your-horse-on-loan-51b1ee7f46767.jpg",
    "https://www.petfinder.com/wp-content/uploads/2012/11/140272627-grooming-needs-senior-cat-632x475.jpg",
    'https://pbs.twimg.com/profile_images/1620031390/The-interesting-thing-is-owned-by-duck.jpg'];

var sb = document.getElementsByClassName('site-branding')[0];
var img = sb.childNodes[1].childNodes[1];
img.style.width = '50%'
img.style.height = 'auto'

for (i = 0; i < pageIds.length; i++) {
    var cls = 'page-id-' + pageIds[i];
    console.log(hasClass(document.body, cls));
    console.log(imgURLs[i]);
    if (hasClass(document.body, cls)) {
        url = imgURLs[i];
        img.src = url;
        return null;
    }
}