• I have 2 website, on two different domain

    One static website that use (html, css, php) and the other one that is wordpress blog with more that 200 post running database

    I like to be able to retreive 4-5 post from the wp blog, and build (on the fly with php) the static website, so the static website will be a sub sample of the large one. All the magic should append in the static website, accessing the blog remotely, How do I do that ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter menardmam

    (@menardmam)

    I have read and use with success this code from the 1st link you gave me

    <?php
    // Include WordPress
    define(‘WP_USE_THEMES’, false);
    require(‘./blog/wp-load.php’);
    query_posts(‘showposts=1’);
    ?>

    <?php while (have_posts()): the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_excerpt(); ?>
    <p>“>Read more…</p>
    <?php endwhile; ?>

    But I what to get a SPECIFIC POST NUMBER, let say post #1828, i cannot seem to know hos to get it

    I dont know how to integrate that code to make it work

    <?php
    $my_id = 7;
    $post_id_7 = get_post($my_id);
    $title = $post_id_7->post_title;
    ?>

    I’m not so familiar with working with query_posts stuff, but I believe what you are trying to accomplish would happen up in the header section of your page…

    query_posts('showposts=1');
    where that bit is…..I guess you just have to flesh it out more with your requirements….I bet the codex could help more than me on this one unfortunately…. (or some smarter member here)

    Thread Starter menardmam

    (@menardmam)

    Here is the comple code that work for me

    <?php require(‘../mywebsite.com/wp-load.php’);

    function getmypost($number)
    {
    query_posts(‘p=’.$number);
    while (have_posts()) : the_post();
    echo ‘<div class=”post”>’;
    the_title(‘<h1>’, ‘</h1>’);
    the_content();
    echo ‘</div>’;
    endwhile;
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Retreive post for static website’ is closed to new replies.