postedin / yarpp-wpgraphql

使用 wp-graphql 在 Post 类型中创建 relatedPosts 字段。您必须已安装 wp-graphql 和 YARPP。

安装: 262

依赖项: 0

建议者: 0

安全性: 0

星星: 0

观察者: 0

分支: 4

类型:wordpress-plugin

1.1.0 2022-09-06 13:36 UTC

This package is auto-updated.

Last update: 2024-09-06 17:48:58 UTC


README

  • 标签:wpgrahql, yarpp, related-posts
  • 最低要求:5.1
  • 测试到:5.6.2
  • 要求 PHP:7.2
  • 稳定标签:0.0.1
  • 许可证:GPLv2 或更高版本
  • 许可证 URI: https://gnu.ac.cn/licenses/gpl-2.0.html

描述

使用 wp-graphql 在 Post 类型中创建 relatedPosts 字段。您必须已安装 wp-graphql 和 YARPP。

安装

  1. 安装 wp-graphql 插件
  2. 安装 yarpp (Yet Another Related Posts Plugin) 插件
  3. 根据其说明进行配置。
  4. 安装此插件
  5. 通过 WordPress 中的 '插件' 菜单激活插件
  6. 与 wp-graphql 一起使用。字段 "relatedPosts" 将在 GraphQL 模式中的 Post 类型中可用。

示例

{
  post(id: 235912, idType: DATABASE_ID) {
    title
    relatedPosts(where: { limit: 1 }) {
      nodes {
        title
        slug
      }
    }
  }
}

变更日志