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

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

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

helick/related-posts

Composer 安装命令:

composer require helick/related-posts

包简介

The Helick related posts plugin

README 文档

README

Latest Version on Packagist Total Downloads Software License Quality Score

The plugin provides a simple related posts functionality with the following features:

  • Ability to manually override related posts
  • ElasticPress integration

Requirements

Make sure all dependencies have been installed before moving on:

Install

Via Composer:

$ composer require helick/related-posts

Usage

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

$postIds = Helick\RelatedPosts\get(int $postId, array $args = []);

$postId 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

Control supported post types:

add_filter('helick_related_posts_supported_post_types', function (array $postTypes) {
    $postTypes[] = 'your-custom-post-type';

    return $postTypes;
});

Control associated post types:

add_filter('helick_related_posts_associated_post_types', function (array $postTypes) {
    $postTypes[] = 'your-custom-post-type';

    return $postTypes;
});

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email evgenii@helick.io instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固