1
votes

I'm putting together a web site that needed to include some signup and blogging capability. Wordpress seems to be a perfect fit for that portion of the app, so I've started experimenting with it. I see plenty of tutorials on creating custom themes so I don't expect that to be a problem.

What I'm not able to figure out is what to do with the rest of my site. I will have other non-blogging related php pages that will access a database, etc. I see that wordpress has a capability for generic pages of static content, but these would need to be coded PHP pages. I just can't find a way of having the wordpress theme apply to other php pages outside of wordpress. I was hoping of just doing something like

wp_header();
blah blah
wp_sidebar();
blah blah
wp_footer();

but I'm not really seeing any examples or documentation on how this might be done. Am I missing a key piece of documentation?

EDIT: The answer is to essentially copy and paste a file from the theme, with one crucial addition:

require( dirname(__FILE__) . 'path_to_wp_root/wp-load.php');

That sets up the wordpress environment and allows me to call get_header(), get_sidebar(), get_footer(), etc.

6

6 Answers

1
votes

Generally, "yes".

A well-designed WordPress theme uses mostly CSS/Stylesheets for display, and you are correct in your assumptions: Look through the "Codex" about Theme Design / Template Design (http://codex.wordpress.org/Stepping_Into_Templates).

Essentially you could base your design on some of the current theme files, but leave out "the loop".

1
votes

I think what you really want to do is include wp-load.php at the top of your php file. This will give you access to all the wordpress functions (wp-header(), wp-footer(), etc).

1
votes

wordpress has pages in it. each page can have its own content and its own template and still be part of the whole wordpress site. i mean it will share the header and the footer if you want and will share the css and javascript that you include in both. for more information on pages and pages templates

0
votes

What you should do is develop your other non-blogging related php pages as a wordpress plugin. There are plenty of references online on how to do this, for example:
http://www.tutorialized.com/view/tutorial/Creating-a-Custom-Wordpress-Plugin-from-Scratch/41834

0
votes

Another option is to use Wordpress as the CMS for all content on your site. This is increasingly becoming popular, as Wordpress is quite good at non-blog-things these days.

0
votes
          define('STYLESHEETPATH', '');
          define('TEMPLATEPATH', '');
          $base = substr(__DIR__, 0,strrpos(__DIR__, '/[name of the dir where u store the php files]'));
          require_once($base."/wp-load.php");
          require_once($base."/wp-includes/pluggable.php");

easy to use wordpress function outside