ralfhortt/wp-meta-box-address

WordPress地址数据元框插件

2.1 2020-11-23 20:08 UTC

This package is auto-updated.

Last update: 2024-09-24 05:00:14 UTC


README

将地址数据字段作为元框添加

  • 街道 / 街道号码
  • 邮政编码 / 城市
  • 地址附加信息
  • 国家
  • 地图

安装

composer require ralfhortt/wp-meta-box-address

使用方法

/*
new MetaBoxAddress(
    array $screen = ['post'],
    string $context = 'advanced',
    string $priority = 'default'
)
*/

服务加载器

use RalfHortt\MetaBoxAddress\MetaBoxAddress;

PluginFactory::create()
    ->addService(MetaBoxAddress::class, ['page'], 'advanced', 'default')
    ->boot();

独立

use RalfHortt\MetaBoxAddress\MetaBoxAddress;

(new MetaBoxAddress(['page'], 'advanced', 'default' ))->register();

钩子

过滤器

  • wp-meta-box-address/meta-box-identifier - 修改元框ID
  • wp-meta-box-address/meta-box-label - 修改元框标签
  • wp-meta-box-address/street-{$postType} - 隐藏对于$postType的街道字段
  • wp-meta-box-address/streetnumber-{$postType} - 隐藏对于$postType的街道号码字段
  • wp-meta-box-address/address-additional-{$postType} - 隐藏对于$postType的地址附加信息字段
  • wp-meta-box-address/zip-{$postType} - 隐藏对于$postType的邮政编码字段
  • wp-meta-box-address/city-{$postType} - 隐藏对于$postType的城市字段
  • wp-meta-box-address/country-{$postType} - 隐藏对于$postType的国家字段
  • wp-meta-box-address/latitude-{$postType} - 隐藏对于$postType的纬度字段
  • wp-meta-box-address/longitude-{$postType} - 隐藏对于$postType的经度字段

示例

<?php
add_filter('wp-meta-box-address/country-post', '__return_false');

动作

  • wp-meta-box-address/before - 在街道字段之前添加字段
  • wp-meta-box-address/after - 在国家字段之后添加字段
  • wp-meta-box-address/save - 保存自定义字段

待办事项

  • 地理编码地址
  • 模板标签

变更日志

2.1 - 2020-11-23

  • 更新 wp-meta-box 依赖

2.0 - 2020-11-06

  • 更新 wp-meta-box 依赖
  • 添加翻译
  • 修复 composer.json 中的错误

1.1.0 - 2020-01-28

  • 添加纬度元字段
  • 添加经度元字段

1.0.0 - 2020-01-14

  • 首次发布