首页 > 解决方案 > 如何在wordpress中更改网站特定页面上的徽标?

问题描述

我在 wordpress 的网站上工作。

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

请有人告诉我如何做到这一点,主要标志应该出现在整个网站上,而辅助标志应该出现在我网站的一页上

标签: csswordpressimage

解决方案


您可以使用该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
}

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

如果它是列表页面或单个帖子页面,那么您可以使用不同的检查方法。所有这些都在这里描述。


推荐阅读