我的 Wordpress 网站使用这样的自定义模板页面:
<php
/*
Template Name : project_costs
/*
get_header ();
// set default vars or user received
require("my_forms.php");
// pull data from db and calculate
require("project_calculation. php");
// create page
require("content. php");
...
我的自定义页面project_costs.php
执行以下步骤:
- 从页面表单(POST/GET)接收和设置用户输入的变量。
- 从数据库中提取数据。
- 做一些计算和改变。
- 为用户创建页面。
我想将angular.js与 WP-API 插件集成。该插件只是从数据库中提取原始数据(步骤 2)并将其发送到前端(步骤 4)。因此,未作为页面使用的页面和模板不会重新加载。
我想先将数据传递给我的 php 类(第 3 步),然后将更改的数据传递给 WP-API。
WP-API 中是否有任何函数可以调用我的 PHP 文件或函数?
任何建议、样本或链接将不胜感激。
谢谢。