Support » Fixing WordPress » [1.5] Integrating WordPress into existing PHP site

  • Hey guys!

    I’ve decided to give WordPress a go and I’m working on integrating it into a client’s website. I don’t want all the fancy features, just the plain simple blog entries to show up within the site I’ve built.

    I followed the tutorial at:

    http://www.chrisjdavis.org/2004/05/07/adding-wordpress-to-an-existing-site/1/

    ..and after all that, wound up with a bunch of parse errors. A friend of mine had a look at the code and said it was really messy, opening and closing way too much. I was wondering if maybe the code wasn’t built to work on 1.5?

    Anyway, any thoughts or suggestions would be greatly appreciated. I’m really looking forward to moving ahead with this!

    Thankyou all in advance, you guys have built a great piece of software here and I’m looking forward to supporting you :).

    -Jonathan Wold

Viewing 15 replies - 1 through 15 (of 31 total)
  • Well that’s an old tutorial from last May and 1.5 just came out this week, so it’s probably out of date.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Basically, you just want to add The Loop to you existing site. However, The Loop for v1.5 is different from The Loop for v1.2 (which is what Chris’ tutorial was written for).

    http://codex.wordpress.org/The_Loop

    Thread Starter Jonathan Wold

    (@sirjonathan)

    Alright.. that’s making a LOT more sense.. I’m still just a bit confused though..

    I understand that I need to add the loop, so I add in all the code and then I get a “fatal error” that says:

    Fatal error: Call to undefined function: get_header() in /site_address/blog.php on line 6

    At the top of the page I wish to integrate the blog into I put:

    <?php
    /* Short and sweet */
    define(‘WP_USE_THEMES’, true);
    require(‘site_address/blog/wp-blog-header.php’);
    ?>

    ..and it still gives the fatal error.. any ideas? Thanks a ton guys πŸ™‚

    -Jonathan

    Thread Starter Jonathan Wold

    (@sirjonathan)

    ..any ideas? πŸ™‚

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    DO NOT use:
    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('site_address/blog/wp-blog-header.php');
    ?>

    Use:
    <?php get_header(); ?>

    Just as the instructions say.

    http://codex.wordpress.org/The_Loop#WordPress_1.5

    Thread Starter Jonathan Wold

    (@sirjonathan)

    Well, I tried that.. and:

    Fatal error: Call to undefined function: get_header() in /site_address/blog.php on line 1

    Remember I’m trying to integrate this into a totally new site that previously had nothing to do with WordPress. Somehow it has to define that function.

    Anymore ideas?

    -Jonathan

    Well, I’m suspecting corrupted files? Re-upload (deleting old files may work better, backup)?

    And you may need just one line to integrate WP (plus the loop)
    require('site_address/blog/wp-blog-header.php');

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    “Remember I’m trying to integrate this into a totally new site that previously had nothing to do with WordPress.”

    That’s what The Loop is for.

    Thread Starter Jonathan Wold

    (@sirjonathan)

    I did experience a bunch of timeouts when uploading.. will try reuploading everything :). Thanks!

    -Jonathan

    Thread Starter Jonathan Wold

    (@sirjonathan)

    I reuploaded all my source code, just incase it was corrupt.

    The top of my blog page now reads:

    <?php require(‘site_address/wp-blog-header.php’); ?>
    <?php get_header(); ?>

    … and when I access the page I get:

    Fatal error: Call to undefined function: get_header() in /site_address/blog.php on line 2

    I have tried without the “require” and of course nothing happens then and I still get the same error.

    Any suggestions guys? I’m a tad discouraged but I’m not giving up :).

    -Jonathan

    I got nothing.
    Have you tried re-download the WP package and re-upload? And you might not want to overwrite; instead, delete first.

    have you tried setting WP_USE_THEMES to ‘false’?

    Thread Starter Jonathan Wold

    (@sirjonathan)

    Hmm.. haven’t tried either of those.. I’ll try redownloading and uploading the package now.. Will let you know :).

    Thread Starter Jonathan Wold

    (@sirjonathan)

    Tried reuploading and still the same error..

    Fatal error: Call to undefined function: get_header() in /site_address/blog.php on line 2

    alphaoide, that info isn’t quite correct.

    sirjonathan, first start with things in the default directory before you try moving it around. Get it working there first. Leave the index.php exactly as it is in the distro and only edit files in the wp-content/themes directory. Copy one of the directories and rename it, then edit header and footer.php to match your existing site.

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘[1.5] Integrating WordPress into existing PHP site’ is closed to new replies.