WordPress.org

Ready to get started?Download WordPress

Forums

Pull wordpress pages to personal website (2 posts)

  1. rowefx
    Member
    Posted 2 years ago #

    Hi guys,

    Okay, I've been messing around with my blog and website to try integrate them both. They are both on the same server.

    My blog is at http://www.domain.com/blog and website at http://www.domain.com

    I've been able to pull the latest posts etc with the wp-load.php file such as;

    <?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    //exact path for wp-load.php.
    // This file is kept in the root of wordpress install
    require('blog/wp-load.php');
    //Query wordpress for latest 4 posts
    query_posts('showposts=5');
    ?>
    
    <?php while (have_posts ()): the_post(); ?>
        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

    However, I'm wanting to be able to pull a whole page from my wordpress blog, by a page I mean, the content of a specific page, the blog/?page_id=51.

    I've tried to read up on the wiki, but I'm really struggling here.

    Thanks,

  2. Pankaj Pandey
    Member
    Posted 2 years ago #

    just replace your query_posts('showposts=5'); with

    $args = array('post_type' => 'page', 'order' => 'asc', 'post__in' => array(51, 141, 143)); query_posts($args);

    change page id in array if you want single put a single id.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags