WordPress在single页面获取当前发布类型的名字

<?php
$postType = get_post_type_object(get_post_type($post));
if ($postType) {
    echo esc_html($postType->labels->singular_name);
}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注