I am trying to create a very simple "intro" page in wordpress which will display a 5 seconds video introduction and then will redirect to the homepage automatically.

I saw that there are many plugins out there but most of them offer too much of what I really need. I would like to use simple page template, set it as the front page and then redirecting to the main homepage of the site.

So I created this "intro" template and it works great I just need to know 2 things:

  1. How do I redirect the page after the movie ends?
  2. How do I make sure that if someone already seen my intro page it will be saved as a cookie and won't show the intro again until next time that he cleans his cookies (or until specific period of time)

If anyone has a direction I would love to hear Thanks Gil

  • you can give meta tag for redirection in that intro page template <meta http-equiv="Refresh" content="6; URL=yoururlhere" /> . in here after 6 seconds the current page will be redirect to the url given in meta tag – Zammuuz Sep 23 '14 at 6:09
  • great and do you have any idea how do I store this page in the user's cookies so he won't see this page the next time he will get there? – gil hamer Sep 23 '14 at 6:13
  • Please see my answer – Zammuuz Sep 23 '14 at 6:26

1) Use meta tag fro redirection

<meta http-equiv="Refresh" content="6; URL=yoururlhere" />

Where the current page will redirect to the given url after 6 seconds.

2) For showing the intro page only for new visitors that is if somebody already seen that it must not be displayed again. for that check in your page header.php add the following at the very top, before the declaration, and don’t leave any spaces between the closing PHP tag and that DOCTYPE tag:

if (!isset($_COOKIE['visited'])) /* if the visitor is a new */
 setcookie('visited', true, time() + 3600 * 24);


As like you said , you need to use javascript . here is the code for setting cookie in javascript and checking if it exist.

if (document.cookie.indexOf("visited") >= 0) {
   alert("hello again");
else {
document.cookie = "visited=true; max-age=" + 60 * 60 * 24 * 10; // 60 seconds to a minute, 60 minutes to an hour, 24 hours to a day, and 10 days.
alert("This is your first time!");

to read more about cookie setting in javascript please view this

  • Anyway I cann add that as a JS function like so: code<script type="text/javascript"> $(document).ready(function() { if (!isset($_COOKIE['visited'])) /* if the visitor is a new */ { setcookie('visited', true, time() + 3600 * 24); } } </script>code because it's a separate template and is not connected to the header.php Thanks – gil hamer Sep 23 '14 at 7:34
  • Good.. try it and if that works please mark this as the answer.. – Zammuuz Sep 23 '14 at 7:36
  • Not working unfortunately.. I set the intro page as the first page in the wordpress dashboard. it did work, it showed the intro, waited 6 seconds and redirected to where I needed but when I typed the URL again it showed me the intro again like no cookie was stored.. – gil hamer Sep 23 '14 at 7:42
  • did u add any else part for this if like if the cookie is already set then redirect to the home page. bcz u said u added the code in script like the above. so when it checks the cookie is already set but u didn't wrote anything for that case. – Zammuuz Sep 23 '14 at 7:53
  • Yeah, I am not sure what to put in the else statement.. can you give me a hint? – gil hamer Sep 23 '14 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.