Forum Replies Created

Viewing 1 replies (of 1 total)
  • you can try adding the following code to your websites homepage


    <?php
    $wp_post_query = mysql_query("select wp.ID, wp.post_content, wp.post_title, wp.post_date, wp.post_author, wp.comment_count FROM wpb_posts wp LEFT JOIN wpb_term_relationships wtr ON wp.ID=wtr.object_id WHERE wp.post_status = 'publish' ORDER BY wp.post_date desc limit 2"); // change limit to show more posts

    while ($wp_post = mysql_fetch_array($wp_post_query)) {
    $code_array = array(
    "#\[.+\]#siU",
    "#\<.+\>#siU"
    );
    $postContent = preg_replace($code_array, '',$wp_post['post_content']);
    //$postContent = preg_replace("/[^ ]*$/", '', substr($postContent, 0, 110)); // limits content of each post to 110 chars
    $postContent = preg_replace("/[^ ]*$/", '',$postContent);
    echo '<h4>' . $wp_post['post_title'] . '</h4>';
    echo '<div class="postContent">' . $postContent . '...</div>';
    }
    ?>

    tested with WP2.8 and as far as I remember with 2.6

    hope it helps

Viewing 1 replies (of 1 total)