📜  wordpress 更改帖子格式 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:43.035000             🧑  作者: Mango

代码示例1
add_theme_support( 'post-formats', array('aside','video','gallery','chat'));

function rename_post_formats($translation, $text, $context, $domain) {
    $names = array(
        'Aside'  => 'No Featured image',
        'Chat'  => 'Full Width',
    );
    if ($context == 'Post format') {
        $translation = str_replace(array_keys($names), array_values($names), $text);
    }
    return $translation;
}
add_filter('gettext_with_context', 'rename_post_formats', 10, 4);