vtrotot/annuaire-post-type

WordPress 主题自定义文章类型的目录

2.1 2022-03-01 08:32 UTC

This package is auto-updated.

Last update: 2024-09-29 05:49:55 UTC


README

AnnuairePostType 是一个允许向 WordPress 主题添加自定义文章类型 vt_annuaire 的包。
此自定义文章类型添加了四个元数据:负责人、地址、电话号码和电子邮件。

VincentTrotot\AnnuairePostType 类配置自定义文章类型,而 VincentTrotot\Annuaire 类是 Post 的包装器(该类继承自 Timber\TimberPost 类)。

安装

composer require vtrotot/annuaire-post-type

使用

您的主题必须实例化 AnnuairePostType

new VincentTrotot\Annuaire\AnnuairePostType();

然后您可以获取一个目录类型的文章

$post = new VincentTrotot\Annuaire\Annuaire();

或使用

$args = [
    'post_type' => 'vt_annuaire',
    ...
];
$posts = new Timber\TimberRequest($args, VincentTrotot\Annuaire\Annuaire::class);