Archived topic
Hook Element stopped working
7 replies · Started by jregist on January 9, 2021
My site is at https://gfa.wishfulthinking.us/
I updated the image for the logo on our site, and suddenly the Hook Element that switched to the white menu (for pages with image backgrounds) stopped working. It has been working fine until I made this update to the image files. Here's the text of the php.
<?php if ( is_page( array( 12, 179, 'Blog' ) ) ) : ?>
<script>
function getLogo() {
var img = document.getElementsByClassName('header-image')[0];
img.src='https://gfa.wishfulthinking.us/wp-content/uploads/2021/01/Logo_subtitle_white_updated.png';
}
getLogo();
</script>
<?php endif; ?>
The hook I am assigning this is wp_footer. And the display rules is all pages.
Hi there,
Sorry not sure why the custom function is needed there?
Have you considered using our built-in header element solution?
https://docs.generatepress.com/article/transparent-header-and-navigation/
We cannot help with custom code in the forum here.
I didn't think I could use the built-in Header element because of my split nav with the logo in the center.
I'm looking into this now. Do you foresee any issues with the split nav that I'm using?
The header element method should work for the split nav :)
Nice - I got it working on this page as a test - https://gfa.wishfulthinking.us/first-page/
However, it looks like there's a style issue. Logo coming after the right nav instead of in the middle. This is a much better solution. Can you give me any ideas about how to fix the styles?
Actually, I found the issue with my custom code. If you have a quick fix for the header layout css with the Header element, let me know. Thanks!
Thanks for the help!
Is everything good now?
Please open a new topic if you need another look with something else :)