[wordpress插件] Arha Routes阿拉哈航线

wordpress 插件 文章 2020-02-21 02:10 527 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

WordPress plugin that helps to serve content through REST routes and gives

WordPress插件,可帮助通过REST路由提供内容并提供

customizability to developers through filters.

通过过滤器对开发人员的可定制性。

Available Routes

可用路线

    • /wp-json/arha/v1/post
    • / wp-json / arha / v1 / post

    • /wp-json/arha/v1/page
    • / wp-json / arha / v1 / page

    • /wp-json/arha/v1/options
    • / wp-json / arha / v1 / options

    • /wp-json/arha/v1/archive
    • / wp-json / arha / v1 / archive

    Example queries

    查询示例

      • /wp-json/arha/v1/post?post_type=POST_TYPE&slug=SLUG
      • / wp-json / arha / v1 / post?post_type = POST_TYPE&slug = SLUG

      • /wp-json/arha/v1/page?path=PATH
      • / wp-json / arha / v1 / page?path = PATH

      • /wp-json/arha/v1/options
      • / wp-json / arha / v1 / options

      • /wp-json/arha/v1/archive?post_type=POST_TYPE&posts_per_page=POSTS_PER_PAGE&paged=PAGED&orderby=ORDERBY&order=ORDER
      • / wp-json / arha / v1 / archive?post_type = POST_TYPE&posts_per_page = POSTS_PER_PAGE&paged = PAGED&orderby = ORDERBY&order = ORDER

      tax_query in archive-route

      归档路由中的tax_query

        • tax_query is supported and it works how the query is built for it in new WP_Query()
        • 支持

        • tax_query ,它可以在 new WP_Query() 中为其构建查询

        • tax_query value needs to be passed in as stringified json
        • tax_query 值需要作为字符串化的json传入

        Multiple post_types in archive-route

        归档路径中有多种post_types

          • To pass multiple post_types in archive-route, use syntax that lets PHP read GET-param as an array.

          • 要在归档路由中传递多个post_type,请使用使PHP读取GET-param作为数组的语法。

            https://stackoverflow.com/a/9547490

          • https://stackoverflow.com/a/9547490

          Filters

          过滤器

            • To exclude querying specific post types from post– and archive-routes, you

              要从 post –和 archive -路由中排除查询特定帖子类型,请

              can use following filters:

              可以使用以下过滤器:

              add_filter('arha_routes/archive_excluded_post_types', 'exclude_post_types');

              add_filter('arha_routes / archive_excluded_post_types','exclude_post_types');

              add_filter('arha_routes/post_excluded_post_types', 'exclude_post_types');

              add_filter('arha_routes / post_excluded_post_types','exclude_post_types');

              function exclude_post_types($excluded_post_types) {

              函数exclude_post_types($ excluded_post_types){

              $excluded_post_types = ['post'];

              $ excluded_post_types = ['post'];

              return $excluded_post_types;

              返回$ excluded_post_types;

              }

              }

            • To format post-route’s post before it’s served to client, use arha_routes/format_post-filter

              要在将 post -route的帖子提供给客户之前对其进行格式化,请使用 arha_routes / format_post -filter

              add_filter('arha_routes/format_post', 'format_post');

              add_filter('arha_routes / format_post','format_post');

              function format_post($post) {

              函数format_post($ post){

              return $post;

              返回$ post;

              }

              }

            • To format page-route’s post before it’s served to client, use arha_routes/format_page-filter

              要在发送给客户之前格式化 page -route的帖子,请使用 arha_routes / format_page -filter

              add_filter('arha_routes/format_page', 'format_page');

              add_filter('arha_routes / format_page','format_page');

              function format_page($page) {

              函数format_page($ page){

              return $page;

              返回$ page;

              }

              }

            • To format archive-route’s posts before they are served to client, use arha_routes/format_archive_post-filter

              要在将存档 -route的帖子提供给客户之前对其进行格式化,请使用 arha_routes / format_archive_post -filter

              add_filter('arha_routes/format_archive_post', 'format_archive_post');

              add_filter('arha_routes / format_archive_post','format_archive_post');

              function format_archive_post($post) {

              函数format_archive_post($ post){

              return $post;

              返回$ post;

              }

              }

            • options-route returns empty result by default.

              选项 -route默认情况下返回空结果。

              To add content to it, use arha_routes/format_options-filter

              要向其中添加内容,请使用 arha_routes / format_options -filter

              add_filter('arha_routes/format_options', 'format_options');

              add_filter('arha_routes / format_options','format_options');

              function format_options($options) {

              函数format_options($ options){

              return $options;

              返回$ options;

              }

              }

            SearchWP

            SearchWP

            Arha Routes supports SearchWP-plugin, which lets WP users to make keyword search engine for their content.

            Arha Routes支持SearchWP插件,该插件使WP用户可以为其内容创建关键字搜索引擎。

            Activating SearchWP-plugin adds optional keyword-search functionality to archive-route.

            激活SearchWP插件会将可选的关键字搜索功能添加到 archive -route。

            This is done by adding s=KEYWORD to the route

            这是通过将 s = KEYWORD 添加到路由
            来完成的

            – Example: /wp-json/arha/v1/archive?post_type=products&posts_per_page=10&paged=1&orderby=date&order=ASC&s=monitor

            –示例: / wp-json / arha / v1 / archive?post_type = products&posts_per_page = 10&paged = 1&orderby = date&order = ASC&s = monitor

            Polylang

            Polylang

            Arha Routes supports Polylang-plugin, which allows users to create content in multiple languages.

            Arha Routes支持Polylang插件,该插件允许用户创建多种语言的内容。

            Activating Polylang changes how endpoints work:

            激活Polylang会更改端点的工作方式:

              • All routes require additional lang-param

              • 所有路线都需要附加的 lang -param

                  • Example: /wp-json/arha/v1/archive?post_type=products&posts_per_page=10&paged=1&orderby=date&order=ASC&lang=en
                  • 示例: / wp-json / arha / v1 / archive?post_type = products&posts_per_page = 10&paged = 1&orderby = date&order = ASC&lang = zh_CN

                • page-route doesn’t support language prefix in path

                • 页面 -route路径中不支持语言前缀

                    • Example: Permalink /zh/info, use like this /wp-json/arha/v1/page?path=/info&lang=zh
                    • 示例:永久链接 / zh / info ,像这样 / wp-json / arha / v1 / page?path = / info&lang = zh

                    • Example: Permalink /en/info/test, use like this /wp-json/arha/v1/page?path=/info/test&lang=zh<

                    • 示例:固定链接 / en / info / test ,像这样 / wp-json / arha / v1 / page?path = / info / test&lang = zh <

                      /li>

                      / li>

                  • options-route passes lang-param forward to arha_routes/format_options-filter

                  • 选项 -route将 lang -param传递给 arha_routes / format_options -filter

                    add_filter('arha_routes/format_options', 'format_options', 10, 2);

                    add_filter('arha_routes / format_options','format_options',10,2);

                    function format_options($options, $lang) {

                    函数format_options($ options,$ lang){

                    return $options;

                    返回$ options;

                    }

                  • }

                  Polylang + SearchWP

                  Polylang + SearchWP

                  In order to make these two plugins work together, you need to add extra plugin to WP installation.

                  为了使这两个插件协同工作,您需要在WP安装中添加额外的插件。

                  https://searchwp.com/extensions/polylang-integration/

                  https://searchwp.com/extensions/polylang-integration/

下载地址
https://downloads.wordpress.org/plugin/arha-routes.zip
-EOF-

AI助手支持GPT4.0


三叔工具箱

摸鱼人热门新闻聚合

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Add Anchor Links添加锚链接
[wordpress插件] Carousel Gallery旋转木马画廊
[wordpress插件] Character Count for Post Content &amp; Excerpt帖子内容和节选的字符计数
[wordpress插件] SEO A/B Split Testing: Google Search Engine Optimization (SEO) PluginSEO A / B拆分测试:Google搜索引擎优化(SEO)插件
[wordpress插件] Bot Libre Live Chat机器人免费在线聊天
随便看看
微信公众号免300认证教程 4679
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 3795
小程序广告组件通过审核,但是小程序内没有显示广告? 3870
企业微信通讯录账号被管理员误/恶意删除,怎么办? 7745
问题? 7018
如何快速搭建抽奖助手小程序(无需代码知识) 4827
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 5774
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5213
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5018
如何解决渲染层网络错误Failed to load media? 16275