Support » Fixing WordPress » Retreive post for static website

  • 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)
  • I have read and use with success this code from the 1st link you gave me

    // Include WordPress
    define(‘WP_USE_THEMES’, false);

    <?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

    $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…

    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)

    Here is the comple code that work for me

    <?php require(‘../’);

    function getmypost($number)
    while (have_posts()) : the_post();
    echo ‘<div class=”post”>’;
    the_title(‘<h1>’, ‘</h1>’);
    echo ‘</div>’;

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