kunoichi/term-meta 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kunoichi/term-meta

Composer 安装命令:

composer require kunoichi/term-meta

包简介

A utility for handle term meta easily.

README 文档

README

A WordPress utility to handle term meta easily.

Installation

composer require kunoichi/term-meta

Usage

In your theme's functions.php:

if ( class_exists( 'Kunoichi\TermMeta\ColorMeta' ) ) {
	new Kunoichi\TermMeta\ColorMeta( 'category_color', 'category', [
		'label'        => __( 'Color', 'your-domain' ),
		'admin_column' => true,
	] );
}

To get this color, use WordPress builtin function get_term_meta( $term_id, $meta_key, $single ) .

<?php
// For example, display category title
// with specified background color
// in category archive.
$color = get_term_meta( get_queried_object_id(), 'category_color', true ) ?: '#000';
?>
<h1 style="background-color: <?php echo esc_attr( $color ) ?>">
	<?php the_archive_title(); ?>
</h1>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2019-09-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固