【问题标题】:Yoast Seo change parameter page in a Title and DescriptionYoast Seo 更改标题和说明中的参数页面
【发布时间】:2017-11-10 02:15:37
【问题描述】:

使用 yoast seo 我有这个设置 标题和元数据 -> 标题模板:%%title%% %%page%% %%sep%% %%sitename%%

在在线站点中,我的结果标题是: 我的帖子标题 – 第 2 页,共 230 页 – 网站名称

可以在以下位置更改参数 %%page%%: 我的帖子标题 – 第 2 页 – 网站名称

我将从我的标题中删除 230。谢谢

【问题讨论】:

    标签: wordpress yoast


    【解决方案1】:

    您可以使用翻译过滤器来做到这一点。

    创建此目录和文件:
    wp-content/mu-plugins/yoast-tweaks.php

    <?php // Requires PHP 5.4+.
    add_filter( 'gettext', function ( $translation, $original, $text_domain ) {
        if ( 'wordpress-seo' === $text_domain ) {
            if ( 'Page %1$d of %2$d' === $original ) {
                $translation = 'Page %1$d';
            }
        }
        return $translation;
    }, 10, 3 );
    

    【讨论】:

    • 是的,如果wp-content/mu-plugins 目录不存在,则创建它。见:codex.wordpress.org/Must_Use_Plugins
    • 或者把这个(减去开头的&lt;?php标签)放到你的主题的functions.php文件中。无论哪种方式都可以。
    猜你喜欢
    • 2014-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多