Derek Derek - 1 month ago 7
PHP Question

Add a Blog to an Existing Webpage

How can I insert a blog (not created yet) into and already existing 'static' webpage? The webpage is written mostly in php. I'm considering using something like wordpress.org (host install version) and using it to update the website's news page.

From what I've read, its sounds like I would need to do a lot of theme tweaking to get wordpress to display correctly with our website's template. This sounds a bit daunting to me. Any thoughts on the matter are appreciated!

Answer

I did the exact same thing on my site. I had about 20 static pages, wanted to add a blog and wanted to add content from the WP pages to the static pages. It was not hard to find a theme that (almost) matched my static pages. Everything outside of /tech/ is a static page.

You can also get a very minimalistic theme and then make it match your design. Its one big heaping cut and paste of CSS, re-labling elements to match what WP wants then a little tweaking. I've done it in under 8 hours on other sites.

Read up on using the Wordpress loop. This is so much easier than you think its going to be, especially if your stuff is already done in PHP.

Edit:

Here's a snippet of the code that I use in my static pages, which allows me to then use all of the other WP functions in the existing code:

<?php
if (empty($wp))
   require_once("tech/wp-config.php");
wp();
?>

Then, getting a list of recent posts is as easy as:

<?php get_archives('postbypost', 8); ?>

Just look out for using depreciated functions, I've got a few still left to clean out from when I integrated WP 2 years ago.