vtrotot/mag-post-type

WordPress 主题的 Mag 自定义文章类型

1.1.1 2021-09-01 06:26 UTC

This package is auto-updated.

Last update: 2024-09-29 05:36:33 UTC


README

MagPostType 是一个允许在 WordPress 主题中添加自定义文章类型 vt_kiosque 的包。
此自定义文章类型添加了两个元数据:PDF 文件的名称和 URL。

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

安装

composer require vtrotot/mag-post-type

使用

您的主题必须实例化 MagPostType

new VincentTrotot\Mag\MagPostType();

然后您可以获取 Mag 类型的文章

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

或通过以下方式获取多个文章

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