WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display blog posts on separate static page (5 posts)

  1. allanlud
    Member
    Posted 1 year ago #

    Hi,

    I have a static site that has WordPress installed in a subfolder (/blog) and I want to display 3 recent blog posts on the homepage of the static site.

    I found this site - http://code.adonline.id.au/display-wordpress-stories-and-images-on-a-non-wordpress-web-page/ - but it doesn't seem to be working for me.

    Any ideas?

    Cheers,
    Al.

  2. Deepanker Verma
    Member
    Posted 1 year ago #

    You can try RSS feeds. Display recent blog posts on the static page via RSS and PHP.

    See this article. http://webtips.in/parse-and-display-rss-feeds-with-php

    I am sure it will help

  3. Jeffrey van Rossum
    Member
    Posted 1 year ago #

    You could also include wp-blog-header.php and then simply use the loop. For example:

    require('blog/wp-blog-header.php');
    
    query_posts('category_name=news');
    if ( have_posts() ) {
    	while ( have_posts() ) {
    		the_post(); 
    
    		the_title();
    
    	}
    }
  4. allanlud
    Member
    Posted 1 year ago #

    Thanks for the replies guys.

    jeff I've tried your solution and it is pulling in the latest posts - just need to work on the styling now. If I want to show the latest 3 posts from all categories what would I change that to - category_name=news?

  5. allanlud
    Member
    Posted 1 year ago #

    Ok I've just changed it to showposts=3 and it seems to work.

    Thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.