WordPress.org

Support

Support » How-To and Troubleshooting » PHP Include wordpress

PHP Include wordpress

  • I’m trying to php include wordpress’ index.php in my index.php, I dont use wordpress themes, so installing it on the main directory or having a redirect is out of the question. I was able to do this before with previous versions. Any idea what I can do?

    My site is http://lacerated.org and I’m testing it out on http://lacerated.org/index2.php but I get this error:

    Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/lacerate/public_html/wp/index.php on line 4

    Fatal error: require() [function.require]: Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/lib/php’) in /home/lacerate/public_html/wp/index.php on line 4

Viewing 5 replies - 1 through 5 (of 5 total)
  • I haven’t tried or test this, but you might want to try:

    <?php print file_get_contents('http://www.blahblah.com/index.php'); ?>

    Your index.php should ONLY have `<?php
    /* Short and sweet */
    define(‘WP_USE_THEMES’, true);
    require(‘wp-blog-header.php’);
    ?>`

    Then, go to WP’s default theme in your themes folder and customize the content to be your layout/custom theme. Make sure ‘default theme’ is enabled, just in case, for your WordPress.

    Just ask if you have any more problems, or have questions about this method. It’s what I use, and we can always work around it.

    whooami

    @whooami

    Member

    actually what the OP is doing is perfectly fine given what hes trying to do .. the problem is the ‘wp’ in the path thats in the error.

    where are your wordpress files located? In your root or inside wp/??

    Hi!

    I used <?php print file_get_contents(‘http://machow.net76.net/wordpress/index.php’); ?> to include wordpress into my page: http://machow.net76.net/

    But it totally destroys the layout –> http://machow.net76.net/?page=NB

    WordPress just jumps out of the <div> it is supposed to stay in, and destroys a bunch of layout-items. =/

    solved the problem..

    had to place set the overflow of the div to automatic and put the navigation <div> over the wordpress-div =)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Include wordpress’ is closed to new replies.
Skip to toolbar