homepage Welcome to WebmasterWorld Guest from 54.167.173.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / WordPress
Forum Library, Charter, Moderators: lorax & rogerd

WordPress Forum

    
Embeding Wordpress in a simple PHP template site
joliett89




msg:4415872
 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:

<?php
$subtitle = "Media Services";
include("header.php");
?>

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

include("blog/wp-blog-header.php");

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]

 

rocknbil




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

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.

joliett89




msg:4415974
 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

[codex.wordpress.org...]
[codex.wordpress.org...]

Thank you.

lorax




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

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?

joliett89




msg:4416233
 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.

rocknbil




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WordPress
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved