Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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 an XMLHttpRequest from function.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 in visibility: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.
    #1344896

    First :
    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-page

    If you have some changes on that sponsors – just edit that page ( page as footer ) – and all pages are up to date at once.

    #1344904

    Thank 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.

    #1344910

    Hi 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,
    Rikard

    #1344912

    Hello,
    Yes, it’s ok, you can close this topic.
    Thanks

    #1344920

    Hi,

    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘REPEAT AN ELEMENT ACROSS ALL PAGES AND POSTS’ is closed to new replies.