[wordpress插件] cct_webapicct_webapi

wordpress 插件 文章 2020-03-19 21:20 596 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Many times when a site powered by WordPress wants to supply a Web API for their site, they will work outside of WordPress using either PHP or Ruby on Rails.

很多时候,当由WordPress驱动的网站希望为其网站提供Web API时,它们将使用PHP或Ruby on Rails在WordPress之外运行。

Then they have to write their own functions to get to the information inside the database for their WordPress site.

然后,他们必须编写自己的函数来获取其WordPress网站的数据库内部信息。

I always thought that was a little backwards.

我一直认为那有点倒退。

That is why I wrote the Web API plugin for WordPress.

这就是为什么我为WordPress编写了Web API插件。

With the Web API plugin, you no longer have to do that.

有了Web API插件,您不再需要这样做。

This plugin creates a custom post type called API.

该插件创建一个称为API的自定义帖子类型。

When you create an API post, all of the content will be executed as PHP code just before the theme stuff is executed in WordPress.

当您创建API帖子时,在主题内容在WordPress中执行之前,所有内容都将作为PHP代码执行。

Therefore, you have full access to all the WordPress PHP functions to create whatever you want: JSON output, HTML sniplets, full HTML pages without any of the sites theme or code, or anything else you can imagine.

因此,您可以完全访问所有WordPress PHP函数来创建所需的内容:JSON输出,HTML片段,不带任何网站主题或代码的完整HTML页面,或者您可以想象的任何其他内容。

After the code on the page is executed, then the PHP session will be ended.

页面上的代码执行完后,PHP会话将结束。

安装步骤

    1. Upload cct_webapi.zip to the /wp-content/plugins/ directory and unzip.
    2. cct_webapi.zip 上载到 / wp-content / plugins / 目录并解压缩。

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Create a new API post type with you PHP code and you are running!
    6. 使用您的PHP代码创建一个新的API帖子类型,您正在运行!

下载地址
https://downloads.wordpress.org/plugin/cct-api.1.0.zip
-EOF-

AI助手支持GPT4.0