动态Wordpress博客名称和博客说明

时间:2016-01-26 22:31:25

标签: php wordpress

我正在尝试定义我的Wordpress网站标题(博客名称)和标语(博客描述)。我是新来的,也不知道Wordpress的编码。

if ($country_code=="UK") {
    define('WP_BLOGNAME', 'FOR UK');
    define('WP_BLOGDESCRIPTION', 'UK');
}
else if ($country_code=="AU") {
    define('WP_BLOGNAME', 'FOR Australia');
    define('WP_BLOGDESCRIPTION', 'Australia');
}

我想在wp_config.php中定义它 如果可能请帮助或给我其他解决方案。

2 个答案:

答案 0 :(得分:0)

我认为你不能在wp-config.php中指定标题和标语。 您应该能够使用过滤器来更改标语和博客名称。在插件或主题functions.php中,您可以添加:

add_filter( 'bloginfo', 'mytheme_bloginfo', 10, 2 );
function mytheme_bloginfo( $text, $show )
{
    $country_code = ...   
    if ($show == 'description') {
        if ($country_code=="UK") {
            $text = "UK Description";
        } else {
            $text = "AU Description";
        } 
    }
    else {
        if ($country_code=="UK") {
            $text = "UK Title";
        } else {
            $text = "AU Title";
        }                
    }
    return $text;
}

答案 1 :(得分:0)

我在我的主题的function.php文件中添加了以下代码,我更改了博客名称和博客说明。

Entity {
    id: rootNode

    CameraLens {
        id: cameraLens
        ...
    }

    Entity {
            id: cameraViewport1
            property Transform transform : Transform {
                ...
            }
            components: [cameraLens, transform]
    }

    Entity {
            id: cameraViewport2
            property Transform transform : Transform {
                ...
            }
            components: [cameraLens, transform]
    }
}

这是工作代码。 感谢