WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp-blog-header.php (3 posts)

  1. peiqinglong
    Member
    Posted 6 years ago #

    I want to do what is done here with the codex. Integrate the look and feel with WordPress. I know I'm supposed to stick:

    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');
    ?>

    into whatever external php page I want to use WordPress functions on, but its not working. I'm just getting a blank page. I want to be able to use WP Functions such as get_header, stylesheet_directory, etc. in the wiki. I've tried sticking that line in MediaWiki's index.php and in the skin I'm creating also, but neither method works. Anyone have any luck with this? Thanks!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    This line:
    define('WP_USE_THEMES', false);
    is unnecessary. You don't need to explicitly define it false. It doesn't hurt, but it doesn't help either.

    And this line:
    require('./wp-blog-header.php');

    Assumes that WordPress is installed in your current directory. The single dot is the current directory path. If you have it in a different directory, you need to specify the path to it.

    Say your PHP page is /public-html/test/page.php. And your wordpress is installed in /public-html/wordpress/. In that case, you'd need to have this line:
    require('../wordpress/wp-blog-header.php');

    See? You have to tell it where the file is. The .. is the previous directory. You can also use the full complete path to the file, if you know it.

  3. peiqinglong
    Member
    Posted 6 years ago #

    Otto,

    Gotcha! I was missing the additional period. That solved my problem.

    For future reference for anyone else trying to do this, my WP is in my root, so putting:

    <?php
    require('../wp-blog-header.php');
    ?>

    In the MediaWiki's index.php file at the very top worked great!

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.