Forums

Add latest post to HTML page (7 posts)

  1. dgarrett20
    Member
    Posted 6 years ago #

    I was wondering how to add my latest post to an html page. ex. http://www.davidgarrett.org/blog is my WordPress blog, but what code would I add to http://www.davidgarrett.org/index.html to display my latest post?

  2. vkaryl
    Member
    Posted 6 years ago #

    If you do a search using the field in the upper right corner of the page, you'll find a whole slew of posts relating to this setup. They'll discuss using The Loop and CG-Feedread, and perhaps a couple of other options.

  3. moshu
    Member
    Posted 6 years ago #

    I am not sure any of those solutions will work with an html page...

  4. vkaryl
    Member
    Posted 6 years ago #

    *shrug* No - but then some of them address the fact that the index page has to have a php extension - and really, regardless what it's named, it's still just markup....

  5. moshu
    Member
    Posted 6 years ago #

    OK, I couldn't go to sleep before checking this out :)
    Searched Google for "feeds in html files" and it found several free scripts that would convert the rss feed of your blog into html to display on your webpage.

  6. JohnP
    Member
    Posted 6 years ago #

    Nohaber's solution of creating a minimal .php page in the blog sub-directory then using a SSI to display it on the .html page works well for me:
    http://forums.digitalpoint.com/showthread.php?t=35777

  7. tigercub65
    Member
    Posted 5 years ago #

    I wanted to do the same thing so I created an iframe in my html file -

    <iframe src="headlines.php" name="blog" width="170" scrolling="no" frameborder="0" ><a href="http://www.yourdomain.com/headlines.php" title="whatever u want"></a></iframe>

    Then created a php page, added the following code and titled it 'headlines.php'

    <?php
    $how_many=4; //How many posts do you want to show
    require_once("wordpress/wp-config.php"); // Change this for your path to wp-config.php file ?>
    <?
    $news=$wpdb->get_results("SELECT
    ID,post_title FROM $wpdb->posts
    WHERE
    post_status= \"publish\" ORDER BY 'ID' DESC LIMIT ".$how_many);
    foreach($news as $np){
    printf ("
    <li><a>%s</a></li>
    ", $np->ID,$np->post_title);
    }?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags