承接 humanmade/related-posts 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

humanmade/related-posts

Composer 安装命令:

composer require humanmade/related-posts

包简介

Extensible related posts wrapper with support for manual overrides.

README 文档

README

This plugin provides a simple related posts function with the following features:

  • ElasticPress integration (uses a "More Like This" query)
  • Admin UI for manually overriding related posts

Installation

composer require humanmade/related-posts

Usage

The plugin exposes a single function that returns a list of post IDs.

HM\Related_Posts\get( int $post_id, array $args = [] )

$post_id is the ID of the post to get related content for.

$args allows you some control over the posts that are returned:

  • int limit: defaults to 10
  • array post_types: array of post types to limit results to. Defaults to [ 'post' ]
  • array taxonomies: array of taxonomies to compare against. Defaults to [ 'category' ]
  • array terms: array of WP_Term objects, results will match these terms
  • array terms_not_in: array of WP_Term objects, results will not match these terms
  • bool ep_integrate: if true then ElasticPress is used to get the results, Defaults to defined( 'EP_VERSION' )

Custom post type support

To add related posts support to your custom post type simply declare the following:

add_post_type_support( 'your-custom-post-type', 'hm-related-posts' );

In addition to fine control the post types that have related posts support you can use the hm_rp_post_types filter.

add_filter( 'hm_rp_post_types', function ( $post_types ) {
    // your code goes in here

    return $post_types;
} );

Made with ❤️ by Human Made

统计信息

  • 总下载量: 4.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 18
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2018-11-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固