How To Create Pages Outside of WordPress (that look like they’re part of your blog)

Richard CummingsQuick Solutions, Technologies/SolutionsLeave a Comment

Occasionally, I have a need to create pages outside of WordPress but make them look like they are part of my blog.

There are many reasons for doing this.  In my case, I sometimes want to code a PHP page and not have WordPress interfere at all.  There are some good tools to accomplish this within WordPress (like Exec-PHP), but there are times when you need absolute control…you need your own page.

However, you want this page to “appear” as if it’s part of your blog even though it is not.

In this tutorial, I will show you how to create Create Pages Outside of WordPress that look like they are part of your blog.  Additonally, we will take a look at how to link to these pages with your blog framework.

To perform the following tasks, you will need basic knowledge on how to edit text/PHP files and upload/download from your website. (I use UltraEdit for all of my text editing as I believe that it is the best, but you can also use a text editor of your choosing.)

NOTE: This article was written many years back and, since publication, my blog theme has been updated. Thus, some of the example links below may be out of order. However, the general idea of this article is still applicable. Many thanks, Richard

Create Pages Outside of WordPress…The Big Picture

It is relatively simple to create pages outside of WordPress that look like they are within your blog.

To understand the process, let’s look at the big picture. We are first going to create a simple text/PHP file that will take care of most of our page. This simple text file will put in the header, sidebar, and footer of our blog.

Thus, we are left with the content that we will be putting on the page. To find out how to place this information within our page, we need to bring up one of our published WordPress Pages in order to compare it to the page that we have just created.

We will then isolate the area that contains the article contents and add this to our static file.

To conclude, we will look at how to SEO optimize our static page outside of WordPress and then add it to our linking system within WordPress.

Create a Static Page Outside of WordPress: Step-by-Step

Step 1:

Within UltraEdit or your favorite text editor, create a page called myoutsidepage.php. The contents of this file should look like this:

<? 
define('WP_USE_THEMES', false);
require('wp-blog-header.php');
// (August 2011 Update:  You may need to replace the line directly above with the line directly below:
// require('wp-load.php'); 
?>

<? get_header(); ?>
<? get_sidebar(); ?>
<? get_footer(); ?>

Now, copy this page up to your webserver and view it (http://www.yourdomain.com/myoutsidepage.php). You will see that it is beginning to look like your blog with just those few lines. The main part lacking is the article body and perhaps the spacing is thrown off. Here is what my page looks like: https://richardcummings.info/my-outside-page.php

Step 2

Now, you will need to compare the web contents of the page that you just created with an active, published article on your site.

To do this comparison, use View | Page Source within your chosen browser to bring up the page that you just created and a published post on your site. (Learn how to Change Firefox View Source Application if you don’t like the built-in one.)

The top part of the HTML code of each page will be essentially the same. This information is drawn from the header.php file that you referenced in the my-outside-page.php file.

The bottom part of each file will also essentially be the same. This is the information taken from the “sidebar” and “footer” lines.

Now, what you want to do is copy the difference from the “published” article and place it in your my-outside-page.php after the header  information.

As an example, on this web site, the part that I needed to copy began just above the title of the document and ended with the comments. All of the other content came from referenced php files.

After you have placed this new information in your my-outside-page.php file, upload and view it again. Does it look good now? Is the spacing ok? (If not, be sure that you have copied the correct information.)

Now, all that remains is too replace the text that you copied over with the text for the page that you are creating.

Here you can view a full sample page outside of WordPress that appears to be part of the blog. Page Outside of WordPress Blog.

Also, to provide solid SEO for your Page Outside of WordPress Blog, you will want to add a meta title, description, and keywords. These should be placed at the very top of the document this way:

<head>

<title>Page Outside of WordPress | Richard Cummings</title>

<meta name=”description” content=”This is a page outside of WordPress made to look like a page within WordPress” />

<meta name=”keywords” content=”Page Outside of WordPress” /></head>

Of course, you will want to place your own text in there.

Final Step to Create Page Outside of WordPress: Make The Link to Your Outside Page a Part of Your WordPress Blog

Our final step in making a page outside of our WordPress blog appear that it is inside our WordPress blog is to make this page a part of our internal, blog linking system. In this way, WordPress will view and present this page just like all the others.

To accomplish this, we use a little WordPress plugin called Page Links To. The instructions for how to use this plugin are located on the page referenced above. Essentially, you create a blank WordPress post with a title of your choosing and then you are going to re-direct that post to your new page.

And, Voila!, you are done.

You now have a page outside of WordPress that looks to be a part of your blog.

I hope this article helps. Cheers,
Richard

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.