我正在构建一个小型Web应用程序,并且我想使用JSON API将Wordpress帖子引入到我的Web应用程序中 [英] I am building a small web application and i want to use JSON API to bring in Wordpress posts into my web app

查看:60
本文介绍了我正在构建一个小型Web应用程序,并且我想使用JSON API将Wordpress帖子引入到我的Web应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在构建一个小型Web应用程序.我已经在Ubuntu上进行了全部设置,并且正在使用Wordpress.我想使用一个名为JSON API的插件以一种易于阅读的形式从我的Wordpress博客中获取内容,并且我希望对此进行更新以使其一次仅包含5个帖子,这是最近发布的5个帖子.我环顾四周,我想知道是否有人可以帮助我,让我对如何解决这个问题有所了解?我是一个完整的初学者,我没有以前的经验,我还没有开始输入任何代码或类似的代码,因为我不确定如何启动它.

So I am building a small web app. I have set it all up on Ubuntu and I am using Wordpress. I want to use a plug-in called JSON API to pull in content from my Wordpress blog in an easy to read form and I want this to be updated to say have only 5 posts at a time being the 5 most recent ones. I’ve looked around and I was wondering if someone could help me and give me an idea on how to go about this? I am a complete beginner I have no previous experience I have not started typing any codes or anything like that because I'm not sure how to start it.

推荐答案

您在这里有一些选择,而选择哪种取决于您的工作方式.

You have a few options here, and which one you choose really depends on what works for you.

  1. WordPress具有内置API,但这不是JSON API,而是XML-RPC.它具有丰富的功能,不需要您在WP端编写任何代码即可发布帖子.此处的更多信息: http://codex.wordpress.org/XML-RPC_Support

直接从数据库读取.如果您从同一个盒子中读取内容,这可能是一个更快的实现.只需连接到WordPress使用的数据库并直接查询posts表.

Read directly from the database. This is probably a faster implementation if you're reading from the same box. Simply connect to the database WordPress uses and query the posts table directly.

找到适合您需求的JSON API插件.由于您似乎有特定的要求,因此很难推荐任何一种.尝试一些,看看什么对您有用.不利的一面是您需要使插件保持最新状态,并且您正在使用第三方代码-无论您是否认为这是一件坏事,我都会把它留给您.

Find a JSON API plugin that suits your needs. It's difficult to recommend any as you seem to have specific requirements. Try some, and see what works for you. The downside to this is you'll need to keep the plugin up-to-date, and you're using third-party code - I'll leave it up to you whether you believe that to be a bad thing or not.

写自己的!编写一个小的脚本从WordPress数据库中提取帖子并吐出格式正确的JSON feed应该相对简单.

Write your own! It should be relatively straightforward to write a small script to pull in posts from the WordPress database and spit out a well-formed JSON feed.

这篇关于我正在构建一个小型Web应用程序,并且我想使用JSON API将Wordpress帖子引入到我的Web应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆