如何在wordpress中更改网站特定页面上的徽标?

时间:2019-07-23 06:40:59

标签: css wordpress image

我正在wordpress网站上工作。

我搜索了一个问题,希望使用任何插件在网站的一页中显示不同的徽标,但是我没有找到令人满意的解决方案。

请有人告诉我我该怎么做,主要徽标应出现在整个网站上,而次要徽标应出现在我的网站的一页上

3 个答案:

答案 0 :(得分:0)

如果您了解wordpress开发,则可以使用条件标签。 ref

答案 1 :(得分:0)

您可以使用is_page()方法检查您所在的页面并相应地更改徽标。

因此,在标题或徽标的显示位置,您将像这样进行操作:

<?php
//Returns true when the Pages displayed is either post ID = 42, or post_name is "about-me", or post_title is "About Me And Joe".
if(is_page( array( 42, 'about-me', 'About Me And Joe' ) ) )
{
    //display the secondary logo
}
else
{
    //display the main logo
}

当然,我在这里假设您希望它与众不同的页面是WordPress page

如果是列表页面或单个帖子页面,则可以使用其他检查方法。 here中都有所有描述。

答案 2 :(得分:0)

请将此代码插入您的header.php文件中。

$ss = $wp_query->post->post_title;
                    if($ss == 'your page name'){
                        echo '<img src="/your-new-logo.png" />';
                    }
                    else{
                        echo '<img src="/your-current-logo.png" />';
                    }