• Hi There,
    I’m wondering if anyone can point me in the right direction.

    I am interested in finding out how to Redirect from the homepage to another page in 5 seconds automatically.

    I have found some answers online but nothing that explains
    – what code would work for a wordpress site
    – where to put the code on a wordpress site

    Thanks so much for you help in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Add this just after <body> to the page template in use for your home page:

    <script type="text/javascript">
    window.onload=timeout;
    function timeout(){
    window.setTimeout("redirect()",5000)}
    function redirect(){
    window.location="/welcome/"
    return}
    </script>

    Note: /welcome/ is the slug of the page to be redirected to (inside slashes) and 5000 is the time in milliseconds.

    Correction: Add above just before closing </head>

    Then use something like (use your own CSS) but include the onload:

    <body class="my_splash" onload="timeout()">

    For the body HTML

    The home page template then becomes your ‘splash’ page

    Thread Starter kb1234

    (@karenbatten)

    Thanks so much…
    Ok so I went under appearance > editor > main index template (index.php) to find the page template in use for your home page for the code in the first post. I couldn’t find a <body> so I’m thinking I’m looking in the wrong place.
    In the second post that code goes under appearance > editor > stylesheet.css

    No, that is incorrect on both counts. Unless you fully understand these:
    HTML, PHP, CSS, WordPress Core, etc. etc. I suggest you use an entity that does.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘auto transition from homepage to another page in 5 secs’ is closed to new replies.