Creating intro page in wordpress

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

Leave a Comment