-
AuthorPosts
-
March 17, 2022 at 1:59 pm #1344887
Hello,
I have a Partner/logo element that I want To display on all pages, but I want it to be cloned because otherwise each time I change one logo I’ll have to change it in all the pages.
To achieve this I’m sending anXMLHttpRequest
fromfunction.php
to the homepage, to get the container of the element and position it just above the footer on all pages.
Basically it works, the element is there, I can see it using developer tools, but the animation doesn’t work and images are invisibility:hidden
.
Is there a way to have this working?
My code:function sponsor_code() { if ( !is_front_page() ) { echo "<script> var xhr = new XMLHttpRequest(); xhr.open('GET', 'https://urlofmywebsite', true); xhr.responseType = 'document'; xhr.onload = function(e) { var doc = e.target.response; var sponsor = doc.getElementById('sponsor'); let parentDiv = document.getElementById('footer').parentNode; let footer = document.getElementById('footer'); parentDiv.insertBefore(sponsor, footer); }; xhr.send(); </script>"; } } add_action('wp_head', 'sponsor_code');
- This topic was modified 2 years, 8 months ago by uomopalese.
March 17, 2022 at 2:14 pm #1344896First :
this here :
is the content you like to have on all pages ?
– i can see it on your front-page too – so your code does not take over the if clause ?next Enfold has an option to choose a whole page as footer !
So style a new page ( sponsors ) and set this page to be the footer-pageIf you have some changes on that sponsors – just edit that page ( page as footer ) – and all pages are up to date at once.
March 17, 2022 at 2:39 pm #1344904Thank you very much,
– i can see it on your front-page too – so your code does not take over the if clause ?
Can’t answer this right now, something went wrong…why don’t you design your “footer” via this option.
If you have some changes on that sponsors – just edit that page ( page as footer ) – and all pages are up to date at once.d!
That worked! Never though at that option. Thnak you for your support.March 17, 2022 at 2:48 pm #1344910Hi uomopalese,
Great, I’m glad that @guenni007 could help you out. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardMarch 17, 2022 at 2:50 pm #1344912Hello,
Yes, it’s ok, you can close this topic.
ThanksMarch 17, 2022 at 3:06 pm #1344920Hi,
Thanks for letting us know, I’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.
Best regards,
Rikard -
AuthorPosts
- The topic ‘REPEAT AN ELEMENT ACROSS ALL PAGES AND POSTS’ is closed to new replies.