home info scripts guides links contact

Wordpress Includes

Sometimes, running an entire site on Wordpress, is a wee bit difficult, especially if you're running third-party scripts that don't belong to wordpress, but you still want it to match your layout.

For example, Ask and Answer. I had trouble integrating that to my site's layout and put it in an annoying popup window.

But, in truth, it is possible to include wordpress headers, footers, and sidebars into your script without killing someone.

How to do it

Well first, you have to have a script to do it with, but for whatever script you're using, make sure it doesn't use databases in any of the files besides config.php, it gets messy.

Kinda go through your files, browse through them and skim them and separate the scripting from the cosmetic files.

Scripting files include only scripts and nothing that has to do with the script's look and feel. Don't mess with these, they're dangerous.

How do you tell if a script is cosmetic or scripting? Well, just look through it. If you see any familiar HTML coding inside, like styles, tables, divs, or even text tags, that oughtta do it right there. Those are cosmetic. If it's just a bunch of echo tags and includes, that's a scripting, there's no HTML in it at all.

For those cosmetic files, you're to put this line at the top of each file:


After the require, you'll see a really long include that seems to make no sense. That is called your absolute path. It's the OTHER way to get to a file without using a URL. You are to fill the absolute path with the server's username.

If you don't know what your absolute path is, just put that code on your page, and direct your browser to it. You'll see an error that says PHP error: there is no such file in /home/username/public_html on line ___. That PHP error will actually have the absolute path in it.

I know, it's funny how that works.

Then, to include sidebars and footers, just add the following tags to the bottom of each page:

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


Put those three codes on all cosmetic files in your scripts, and then it will match your WP theme!




copyright 2008 Maggie N