WordPress.org

Ready to get started?Download WordPress

Forums

pulling page links from database (5 posts)

  1. developmental
    Member
    Posted 9 years ago #

    Attempting to pull the titles and the links of the pages within wordpress for a page outside the wordpress directory. Any help being able to display the links would be great.

    --> I guess I dropped this under installation instead of How-To, sorry.

  2. Kafkaesqui

    Posted 9 years ago #

    If this "page outside the wordpress directory" is a PHP document, then you should be able to include the wp-blog-header.php file. An example of this is given for the 1.2 post loop info:

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

    Just make sure the path to it is correct. From then on you can use any of the WordPress functions/features.

  3. developmental
    Member
    Posted 9 years ago #

    I placed the link and made sure the path was correct and it displayed nothing. I'm thinking it is because I'm running 1.5.1.2, if that's not it then I have no idea. I was under the impression wp-blog-header.php displayed more than just the page links, which is all I want. I had orignally planned just to pull the page links directly from the database, without using the any of the wordpress files, but whichever is easier in the long run.

  4. developmental
    Member
    Posted 9 years ago #

    http://codex.wordpress.org/Template_Tags/wp_list_pages

    -- this is exactly what I need but I can't get it to work. Any Help?

  5. Kafkaesqui

    Posted 9 years ago #

    wp_list_pages() is for listing WordPress Pages.

    Including wp-blog-header.php *enables* WordPress in a PHP document so that *any* WordPress function or feature can be put to use. If you're trying to display Page links through wp_list_pages(), you do need to include wp-blog-header.php in your PHP page first. Otherwise you'll have to write your own code that accesses the database, collects the info on the Pages, and then duplicates the functionality of wp_list_pages() in generating a list of links to them.

    If by including wp-blog-header.php you're getting a blank (as in empty) page displayed, try this:

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

    Making sure of course the path to wp-blog-header.php is correct.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags