Welcome to WebmasterWorld Guest from

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Embeding Wordpress in a simple PHP template site



1:31 pm on Feb 9, 2012 (gmt 0)

I have a simple site (header.php, footer.php and some content sites in between) and I want to include Wordpress as one of them. I install it and it works as domainname.com/blog, but I am wondering if I can get it to work under regular header.php, just like with other pages (Home, Services, Resources, Blog, Contact). I am using something like this:

$subtitle = "Media Services";

When I add the following code, it does not load anything,


but a test file like test.php (with echo "This is test etc..") works with the same pathname.

Does anybody know what am I doing wrong.

Thank you.

[edited by: lorax at 12:33 pm (utc) on Mar 2, 2012]
[edit reason] no IPs or URLs please [/edit]


4:33 pm on Feb 9, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

I'm not sure I understand, a whole site, or parts of the Wordpress install?

Generally wp needs wp_head() in the header, which initializes wordpress methods, which will then let you access wordpress pages. If it's not a direct wp page, you may have to add the line below - basically, you need a way to connect to wordpress methods. You'll also need to execute wp_footer() in the footer.

If you just want parts of wordpress, do something like

include ($_SERVER['DOCUMENT_ROOT'] . "/blog/wp-load.php");

then after that, you can access wordpress methods. A typical example would be to include wordpress posts on an otherwise non-wordpress page.


5:18 pm on Feb 9, 2012 (gmt 0)

I've been reading that the only way to do that (probably easier, because everything should be possible at the end, it is just hard work) is to redesign the Wordpress site to look like my website rather than the other way around.
I actually changed some css rules and added a background picture in the admin panel and it looks a lot better already (links above show both).
I am new to WP, so I did not know, but I am looking at creating a Child Theme, or Redesigning a theme a little bit etc. There are also blank/naked (minimalistic) versions of themes, like Starkers (this one is a version of a default WP theme from 2010; there is a lot of them out there) with all the unnecessary code stripped to the minimum so it is esier to start working from scratch etc.
There is also a lot if info about it on wordpress.org


Thank you.


4:15 am on Feb 10, 2012 (gmt 0)

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Hello joliett89. What is the rest of the site (non-WordPress) delivered as? HTML? PHP? Or?

My approach, without knowing all of the details yet, is that I would use WordPress as the primary "wrapper" for the entire site. Then I would handle static HTML or PHP pages on a case by case basis. These may be interwoven into the WordPress CMS via calls in from within the template files or "glued on" as stand alone resources with their own visual framework.

The advantage of using WP as the over-arching tool for delivery of the resources is that you will have a consistent framework and CMS to use/rely on. If you need to make modifications, one change and it's done for all pages within the CMS. Does this seem appropriate for what your situation is?


12:46 pm on Feb 10, 2012 (gmt 0)

That would be probably better, but I started building the site first and then wanted to incorporate the blog etc. It is actually not as hard to do as it seems (after some reading).
The best way to do that was to use the original WP theme (there is a lot of them, but I wanted to use the original one) and override the CSS rules as another Child-Theme (rules that go after the original ones take precedence). It just takes some browser developer tools and figuring out what is what, maybe some changes in some of the Wordpress php files etc.
The site was actually looking good yesterday, but it kind of started falling apart in different browsers (IE, Firefox, Chrome). I looked at browsershots.org and thats even worse. I need to kind of figure out how to get it all together for the future sites too.


4:48 pm on Feb 10, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Right, you can build site pages in "pages" and the blog stays as "blog." In your settings you'd designate which pages is your home page and which is the blog entry page (if the theme doesn't do that for you already.) If it's falling apart, it is likely the theme.

Featured Threads

Hot Threads This Week

Hot Threads This Month