I had a client that, despite my protestations, wanted a “Intro” page for his website – a landing page with a large clickable image and (gulp) embedded autoplay sound. His site was already set up and live in WordPress, and it already had a static homepage… and it was installed at the root of his site.
Aside: We’re using WordPress as a content management system rather than a blogger. I’ve discovered that, for the average small business/site, full blown CMS solutions such as Joomla, Drupal and MODx (the last being my preferred choice) tend to be overkill. The bells and whistles that these packages contain may get developers excited, but in my experience they simply overwhelm the average client. It’s akin to giving someone Photoshop because they need to re-size some images. WP is stable, mature, relatively slick, and probably the easiest to use. I wish I had the time to redo all of my CMS clients sites in WP.
So what I needed was an opening page that didn’t utilize the site theme. That last bit’s the kicker. You can’t just change the index page, or set up .htaccess to re-prioritize the directory index (if you were thinking you’d drop a static index.html page in there and leave WP’s index.php) – both actions turn WP’s navigation kludgy. An option would be to export the theme and database, reinstall WP somewhere other than the root, put your index page in the root, modify your theme and DB data to correct pointers and URLs, and import it into your new install… but that sure sounds like a lot of work, doesn’t it?
Here’s what I did instead:
- Created a php page in the root of the activated theme (wp-content/themes/THEMENAME/). Doesn’t matter what the name of this page is. I named mine front.php because I’m not very creative.
- The first line of this page is this: <?php /* Template Name: New Template Name */ ?>. (Change New Template Name to whatever you like)
- Beneath that line is the code that comprises the landing page.
- Within WordPress, I created a static page named Landing. Doesn’t matter what you put in this page – it isn’t going to show on the site. I put a note to my client, explaining that he would have to contact me for changes to the landing page. Set the Template for this page to New Template Name (meaning whatever you changed the template name to in step 2).
- I then changed the Front page by heading to Settings, Reading and changing Front page displays to Static, Front page=Landing.
That’s it. Obviously, make sure to put a link from the landing page to whatever your WP homepage is (in this case ?page_id=6).
There – that beats the alternatives, no?