WordPress.org

Forums

PHP Include wordpress (6 posts)

  1. Anonymous
    Unregistered
    Posted 6 years ago #

    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

  2. Ryan Paul
    Member
    Posted 6 years ago #

    I haven't tried or test this, but you might want to try:

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

  3. cosmosnow
    Member
    Posted 6 years ago #

    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.

  4. whooami
    Member
    Posted 6 years ago #

    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/??

  5. Anonymous
    Unregistered
    Posted 6 years ago #

    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. =/

  6. Anonymous
    Unregistered
    Posted 6 years ago #

    solved the problem..

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

Topic Closed

This topic has been closed to new replies.

About this Topic