Get WordPress blog post and show in any page

In WordPress blog, our latest posts are publicized on the home page, and older posts access with the help of post page navigation. In this post, we are going to learn how to display our WordPress blog posts on any static or dynamic page using a simplexml_load_file() method with ATOM that works to get WordPress blog post details as XML data with domain link.

There is one pretty Impressive fact that every WordPress blog has “Atom” specified XML file it will only to serve the Data into other servers. Only we need to call it using a PHP method named simplexml_load_file() which simply stores the XML file and changes the file toward Pure XML Detail and then all the data can be accessed in object data format.

Step 1: Making connection with WordPress blog

Load the data into XML data object using simplexml_load_file() and Atom method. It will request to given URL link and get the dataset from it.

Step 2: Display the blog post details

Here we need to get the required details from XML object like Title, Published By, Published Date, Post Description and etc.

Final Code

Here the full final code to get WordPress blog post and show on our page.

Download   Demo

Learn Infinity

Learn Infinity is the most famous Programming & Web Development blog. Our principal is to provide the best online tutorial on web development. We execute the best tutorials for web experts this will help developers, programmers, freelancers and proving free resource you can download or preview the tutorials.

Leave a Reply

Your email address will not be published.

Back to top