Support » Fixing WordPress » I want to show newest posts from my WP blog to my static HTML page.

  • I have a static HTML page at Bestmobilenumbertracker.com where I want to display the latest posts from my WordPress blog.
    I know I can do this by querying the WP database from my HTML site, just want to know if this is the best way to this or there are any other methods too?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You can’t run queries from a purely HTML page. You’ll need to write code in PHP (or some programming language). Since you’re outside of the WordPress environment you’ll need to write your own code to connect to the WordPress database and extract the post content with SQL queries. And then once extracted you’ll need to write the necessary code to display the content in the way you want.

    This isn’t a trivial effort unless you’ve done this sort of thing before.

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    This is trivial.

    There is no need to write custom PHP to grab posts via a database query. Use a simple RSS reader to grab the posts; I can’t remember how many times I’ve done this. see http://simplepie.org/

    You can also use Javascript and an external service: http://blog.superfeedr.com/google-feed-api-alternative/

    Google’s RSS API was very popular, and still works, but is now officially deprecated and there is no telling when it will be stopped for good: https://developers.google.com/feed/?hl=en

    Thanks Songdogtech for mentioning Superfeedr 🙂

    You can indeed easily embed the content of any RSS feed with Javascript with Superfeedr… but more robust solution would be to actually store the data coming *from* superfeedr so you don’t have to load it from our servers.

    Thanks for jumping in songdogtech. Your solution certainly sounds much easier.

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    @julien51: good point; I changed the link to one that explains more how to use the service as a subscriber.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘I want to show newest posts from my WP blog to my static HTML page.’ is closed to new replies.