Wordpress
Integration of Wordpress JSON API in Ionic 4 Full App
Last updated
Integration of Wordpress JSON API in Ionic 4 Full App
Last updated
Ionic 4 Full App has Wordpress JSON API integration in STARTUP and PRO version. Currently the API fetches following in the app
Posts
Single Post detail
User details
All media
Media details
Tag details
This data is arranged in format of a list of blogs, and a detailed blog .
As a demo, base url used for data fetching is
You can replace this url with your own website URL to fetch data from your website.
The blog list is integrated in src/app/pages/wordpress/blogs
. All the API calls happen in src/app/services/wordpress
. This was the API calls can be made in any of the pages or components.
All the blogs are fetched in getBlogs
function of wordpress.services.ts
The response from the API is used in blogs.page.ts
Each post detail in the API response contains only the media IDs of images related to the post. To fetch the details of media, we fetch media detail using another API in getMedia
function of wordpress.services.ts
Fetching all media will return a response like following
Details of a media can be fetched using
Response will be similar to following
On clicking a blog in the blogs list we fetch the detail of that blog (post) in blogpage.page.ts
This is fetched using the blog's ID
The blog's detail API response returns the full blog content, author, tags, media etc.
In the blogs detail API response, tags are returned as an array of IDs. To fetch the details of tags, we use
The response is similar to this
In the blogs detail API response, author is returned as an ID. To fetch the details of author (User), we use
The response is similar to this