April 1st, 2019


Ok, you have multiple WordPress websites that accomplish a common business goal, but each site is different enough to warrant it’s own WordPress install. For example, you are a health care provider that just launched a dedicated WordPress website for the purpose of marketing to potential nursing candidates. You, of course, post various news stories promoting the new website on your main site, driving traffic to the smaller nursing recruitment site. Great!  However you would like these news items on the nursing recruitment site too. These engaging stories would help keep visitors informed, so you repost them on the recruitment site, which is fine except you HATE redundancy.

Wouldn’t it be nice if we could just pull those specific posts rather then reposting them on multiple sites?

Let the WordPress Rest API do the heavy lifting!

“The WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON (JavaScript Object Notation) objects. JSON is an open standard data format that is lightweight and human-readable, and looks like Objects do in JavaScript; hence the name. When you send content to or make a request to the API, the response will be returned in JSON. This enables developers to create, read and update WordPress content from client-side JavaScript or from external applications, even those written in languages beyond PHP.” – WordPress Developer Resources

Customize it

While the Rest API is built into every WordPress site since WordPress 4.4. We can also spin up our own custom endpoints We can quickly run a simple WP Query to create a custom end point that provides a clean valid JSON object that we can do whatever we like with anywhere.  Update all your news your news in one place. No Redundancy!

Here is an example of five posts that we chose to add featured in an external news feed.

Feed Example

As you can see it is very basic. The feed can be utilized by anyone who can decode a JSON object and can be dressed up with CSS and look any way you choose!

Extremely Lightweight

No need for complicated requests or cumbersome plugins that, in the end will not produce the desired outcome. We can ad any meta data we like to the endpoint. We can also use bits and pieces of anything in the JSON object giving us a great deal of flexibility. Our news feeds can look any way you’d like. This is just one very simple example of what we can do with the WordPress Rest API and custom endpoints. It’s pretty powerful when you think what can be done with these custom endpoints…seems like a great starting point.

 

Dan Rivera, MorningStar’s Director Of Web Development, is an expert in WordPress development, graphic design and multimedia production. Dan says, “I wanted to work where I could wear many hats. I wanted to use my design, video, and development skills at different times. MorningStar was a perfect fit.”

If you're ready for growth and to drive your profit, we're here to listen and collaborate.