Page intro in wordpress

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fabby
Forum Commoner
Posts: 62
Joined: Tue Feb 15, 2005 1:06 am
Location: Romania
Contact:

Page intro in wordpress

Post by fabby »

Hi guys!
How can i make an intro page in wordpress?. Without header and footer. First, when you acces the website, i want to appear the intro page, when you can select the language, and then, just to see the rest of the site (but the homepage not to be the intro.html, to be index.php, file that present the site, with header and footer).

Hope you understand what i want... :D
Thanks!
fabby
Forum Commoner
Posts: 62
Joined: Tue Feb 15, 2005 1:06 am
Location: Romania
Contact:

Re: Page intro in wordpress

Post by fabby »

What do you think about this solution.
In index.php i had put the code:

Code: Select all

session_start();
if(empty($_SESSION['ses_intro'])){
	include_once(TEMPLATEPATH.'/intro.php');
	die();
}
and in intro.php:

Code: Select all

<? session_start(); $_SESSION['ses_intro']="yes";?>
What do you say, is ok?
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: Page intro in wordpress

Post by greyhoundcode »

1. Partly as a matter of personal preference I would implement this as a plugin.

2. What if someone stumbles upon your website after a Google search, but they are directed to a specific post rather than the homepage?

If in a situation like this you still want them to be presented with the intro/splash page (and if you don't want to implement this functionality as a plugin) then the theme header file might be a better point at which to check if $_SESSION['ses_intro'] has been set.
Peter Kelly
Forum Contributor
Posts: 143
Joined: Fri Jan 14, 2011 5:33 pm
Location: England
Contact:

Re: Page intro in wordpress

Post by Peter Kelly »

Why don't you just install the wordpress under a directory then create a regular index page in the root ?
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: Page intro in wordpress

Post by greyhoundcode »

Peter Kelly wrote:Why don't you just install the wordpress under a directory then create a regular index page in the root ?
Although that's a simple solution by itself I don't think it would help if he wants the intro/language selection to appear on the visitor's first access (just going by what the OP wrote here). For example, if the visitor went straight to www.blog.com/2011/01/random-post instead of www.blog.com on their first visit.

Personally, I would write a plugin for this as the functionality would then be independent of any future theme changes. In addition this would open up the potential for the "intro" to be a page that can be edited within WordPress, rather than having to go in via FTP and hard-code the changes or whatever.

My second choice would be to work it into the theme files (as the OP seems to be doing, and that might be a faster way of achieving the same thing if you are most comfortable working with theme files). By putting the check on $_SESSION['ses_intro'] within header.php it again means that the visitor can be intercepted on their first access, regardless of what URL it is they access on that first visit.
fabby wrote:First, when you acces the website, i want to appear the intro page, when you can select the language, and then, just to see the rest of the site (but the homepage not to be the intro.html, to be index.php, file that present the site, with header and footer).
Post Reply