定制 ssnepenthe/hestia 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ssnepenthe/hestia

Composer 安装命令:

composer require ssnepenthe/hestia

包简介

This plugin introduces the following shortcodes: [ancestors], [attachments], [children], [siblings], [sitemap].

README 文档

README

This WordPress plugin introduces a number of shortcodes for listing related posts based on post hierarchy.

Requirements

PHP 5.6 or greater and Composer.

Installation

Install using Composer:

$ composer require ssnepenthe/hestia

Usage

Once the plugin has been activated you will have access to the following shortcodes:

ancestors

Lists all post ancestors of the current post.

Accepts the following attributes:

  • id: ID of the post for which you would like to display ancestors. Defaults to the return value of get_the_ID().
  • order: one of ASC or DESC. Sets the sort order of found posts. Defaults to ASC.
  • thumbnails: true or false. Whether or not to include featured images in post list. Defaults to false.

Example: [ancestors order="DESC" thumbnails="true"]

attachments

Lists all media that has been directly attached to the current post.

Accepts the following attributes:

  • id: ID of the post for which you would like to display attachments. Defaults to the return value of get_the_ID().
  • link: one of PAGE or FILE. Sets whether to link to the attachment page or the actual attachment file. Defaults to PAGE.
  • max: integer between 1 and 100. Sets the maximum number of attachments to display. Defaults to 20.
  • order: one of ASC or DESC. Sets the sort order of found posts. Defaults to ASC.
  • thumbnails: true or false. Whether or not to include thumbnails in list. Defaults to false.

Example: [attachments link="FILE" max="50" order="DESC" thumbnails="true"]

children

Lists all child posts of the current post.

Accepts the following attributes:

  • id: ID of the post for which you would like to display children. Defaults to the return value of get_the_ID().
  • max: integer between 1 and 100. Sets the maximum number of children to display. Defaults to 20.
  • order: one of ASC or DESC. Sets the sort order of found posts. Defaults to ASC.
  • thumbnails: true or false. Whether or not to include featured images in post list. Defaults to false.

Example: [children max="35" order="DESC" thumbnails="true"]

siblings

Lists sibling posts of the current post.

Accepts the following attributes:

  • id: ID of the post for which you would like to display siblings. Defaults to the return value of get_the_ID().
  • max: integer between 1 and 100. Sets the maximum number of siblings to display. Defaults to 20.
  • order: one of ASC or DESC. Sets the sort order of found posts. Defaults to ASC.
  • thumbnails: true or false. Whether or not to include featured images in post list. Defaults to false.

Example: [siblings max="65" order="DESC" thumbnails="true"]

sitemap

Lists the most recent posts of each public post type.

Accepts the following attributes:

  • max: integer between 1 and 100. Sets the maximum number of posts to display per post type. Defaults to 20.
  • order: one of ASC or DESC. Sets the sort order of found posts. Defaults to ASC.
  • thumbnails: true or false. Whether or not to include featured images in post list. Defaults to false.

Example: [sitemap max="100" order="DESC" thumbnails="true"]

Custom Output

Shortcode output can be overridden within a theme or child theme. To do so, create the following PHP files either in your theme root or in a templates subdirectory:

hestia-ancestors.php
hestia-attachments.php
hestia-children.php
hestia-siblings.php
hestia-sitemap.php

These templates do not work the same as a standard WordPress loop - They are rendered using the Plates template system with an array of WP_Post objects.

View the existing plugin templates to get an idea of what data will be available in a given file.

A Note About Custom Templates And Post Meta

By default, all queries are performed WITHOUT updating the meta cache unless thumbnails are enabled. It is done this way to minimize the number of database queries performed.

However - if you need to create a custom shortcode template that does access post meta, the result will be an extra database query PER POST!

This is obviously not desirable, so the following filters are provided to force a meta cache update:

hestia_ancestors_preload_meta
hestia_attachments_preload_meta
hestia_children_preload_meta
hestia_siblings_preload_meta
hestia_sitemap_preload_meta

Return true to any of these and all post meta will be loaded in a single query up front rather than a query per post.

Caching

No caching is done by this plugin.

For the most part, these shortcodes run very basic queries and you should not notice any performance impact.

The possible exception is the sitemap shortcode which runs AT LEAST two queries per public post type.

If you have a large number of post types I do not recommend using the sitemap shortcode without a solid caching strategy in place.

ssnepenthe/hestia 适用场景与选型建议

ssnepenthe/hestia 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 106 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ssnepenthe/hestia 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ssnepenthe/hestia 我们能提供哪些服务?
定制开发 / 二次开发

基于 ssnepenthe/hestia 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2016-02-26