Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a blog to an existing webpage

Tags:

php

wordpress

How can I insert a blog (not created yet) into an 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.

like image 505
Derek Avatar asked Mar 07 '09 00:03

Derek


2 Answers

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. It's 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 it's 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 deprecated functions, I've got a few still left to clean out from when I integrated WP 2 years ago.

like image 157
Tim Post Avatar answered Oct 12 '22 02:10

Tim Post


Greg is right, an iframe is an easy way to do this. However, I've run into situations where the iframe will throw off session variables in IE, not sure if this impacts WordPress or not.

If you're going to create a page to house a WordPress install in an iframe, why not just have the link you would use to show the page with the iframe just link to a separate sub-domain where the WordPress install will reside?

My guess is you're not wanting to do a lot with theme development if you're wanting to throw WordPress into an iframe. If this is the case you have a few choices: (a) google for a blank wordpress theme, (b) develop a theme that looks like you're current site so that when a user clicks on a link, they won't know they're on a different platform, (c) don't hide anything and make the WordPress install show up with a different theme. Consider American Express in their OPEN Forum site (http://www.openforum.com/), with their blog at http://blogs.openforum.com/ - same header, slightly different body and layout.

Issues w/ going the iframe route is that a WordPress site will grow in height, where you'll have to set the height of an iframe. You can control this by setting the height to something very large, but then your page will be very large, or you can control the amount of posts that show up in the WordPress admin.

My suggestions, scrap the iframe, install your WordPress on a sub-domain and then link to that sub domain instead of linking to your iframe page

like image 21
Schoffelman Avatar answered Oct 12 '22 00:10

Schoffelman