How can I create a page with a specific URL?

If you tried to create a static file and then load it like a normal file, you may have had trouble because a WP page as we call it, is actually not actually 1 file, but rather a lot of files that tell WordPress how to put together information queried from the database based on the query that is used in the URL. Most modern WP installs use pretty-links which don’t have users see that query “?page_id=561” because it make urls easier to read and more semantic. (Before doing what I list below, I’m pretty sure that if you switch to permalinks, your old query links should still work because permalinks change pretty-links down into queries behind the scenes.)

If you are absolutely positive that you don’t want to make the switch to pretty-links, then you could load WordPress on your own through a static file. To do this we first need to require the wp-blog-header.php file that is located in the WP root directory. So to test this out you can save a file into the root directory, name it secret-page.php and put in the following lines. After you should be able to access it at mysite.com/secret-page.php ( provided mysite.com is your wordpress install directory. It could possible be a different directory then the root folder of your website. Look for the folder with wp-config.php inside it.

<?php
require( 'wp-blog-header.php' );
define('WP_USE_THEMES', true);

get_header();
wp_head();
?>
    <div id="main">

Normally I would not put a file in the root directory, but you also don’t want to put that file in your theme folder and have the url be www.mysite.com/wp-content/themes/secret_page.php ( unless you want to make a rewrite rule redirecting the url yoursite.com/secret-page.php to yoursite.com/wp-content/themes//secret-page.php ). If you do that, just change the require line above to require(‘../../../wp-blog-header’); if you use a typical theme folder. For every folder above the root folder you place the file, you will have to put a set of “../” before the file name, which just means “go back one folder”

To explain what the file above did, it ran the wp-blog-header.php file which started WordPress for you, then the second line told WordPress we wanted to use themes. This way we can get the same look as your site regardless if this file is in the theme folder or not, we will have access to your regularly used theme because WP has it saved as an option in the Database.

Next, the get_header(); line went to your theme and began to print out your websites page, and after that, wp_head() runs all the WordPress head actions. If you are a developer, you can continue on from here alone. If not, but you can handle your own, then goto your theme folder and copy code from index.php or page.php ( whichever page you most want to imitate ). Check out this codex page, http://codex.wordpress.org/Template_Tags – it will explain how template tags work, that will help you to add the same functionality your sites pages usually have to this new page, which is unlisted and only available to people who know the URL. You don’t have to use the ” – that is actually just to demonstrate that is where you should begin your html. I hope this helped.