• I have a plain PHP page outside the wordpress directory on my site and I was hoping to be able to list posts with a specified tag and have them link directly to those posts…. because this is outside the wordpress directory I realize that I’ll need some PHP and possibly mySQL. Can anyone offer suggestions?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter lukemv

    (@lukemv)

    When I try the require heading, I get errors because it doesn’t recognize things like the function file, etc.

    I should say that the page that I am trying to inject wordpress into is fully created (header, content, footer, etc). I am simply trying to get a portion of code to list “related posts”…. but because it is not within the wordpress folder I can’t simply use a widget.

    Thoughts?

    The Codex page I pointed you towards is for exactly this kind of situation. Check the paths on your require statements.

    Thread Starter lukemv

    (@lukemv)

    but when I use “require(‘/the/path/to/your/wp-blog-header.php’);” (with the correct path) it gives errors, not recognizing syntax…

    Are you adding this to a .php file?

    Thread Starter lukemv

    (@lukemv)

    yes, a php file with a variable passed via GET

    Thread Starter lukemv

    (@lukemv)

    What is the basic contents of “wp-blog-header.php” supposed to be? My header file may have too much information within.

    Thread Starter lukemv

    (@lukemv)

    After a long search I found it:

    <?php
    if (! isset($wp_did_header)):
    if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
    	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
    	else $path = 'wp-admin/';
    require_once( dirname(__FILE__) . '/functions.php');
    require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
    wp_die("There doesn't seem to be a <code>wp-config.php</code> file.
    I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>.
    You can <a href='{$path}setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress &rsaquo; Error");
    }
    $wp_did_header = true;
    require_once( dirname(__FILE__) . '/wp-config.php');
    wp();
    gzip_compression();
    require_once(ABSPATH . WPINC . '/template-loader.php');
    endif;
    ?>

    Although, with this, I am getting an error: “Fatal error: Call to undefined function register_sidebar() in…”

    When I remove the functions.php and plugin.php references, I then get the error: “Fatal error: Call to undefined function wp_die() in”

    Pretty much ready to quit. There has to be a better work around… maybe just directly calling the wp-config?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Pull post links from outside of WordPress folder’ is closed to new replies.