Changing header image in functions.php
-
WordPress v4.4.2
BuddyPress v2.5.1I was trying to get the header image to change up under certain conditions. The HTML was displaying like this…
<div id="branding"> <h1 id="site-logo"><a href="URL" rel="home"><img class="header-image" src="LOGO_IMG_V1_URL" alt="" title=""></a></h1> </div><!-- #branding -->
A lot of the search results I was seeing were from questions a few years back and couldn’t tell if there would be a compatibility problem. As an example, I was seeing a few recommendations using CSS with “background: url()” but the current header image wasn’t setup as a background image.
I saw this suggestion and got it to work with Chrome, but wasn’t compatible with latest Edge, Internet Explorer, or Firefox
./genbu-child/functions.php
print <<<CSSTEXT <style type="text/css"> .header-image { content:url("LOGO_IMG_V2_URL"); } </style> CSSTEXT;
Once I can get the header image to update consistently across the browsers I need to add conditions for when that loaded, but need to get the display part working right. Any recommendations I could use in my functions.php to set the header image?
- The topic ‘Changing header image in functions.php’ is closed to new replies.