Wordpress Main Menu - Hide 'Home' link on

2019-05-07 08:48发布

I need to hide the "Home" link that's generated from Wordpress main menu on the homepage, and show it on the rest of the site.

I tried creating my own menu with no "Home" link and adding the "Home" link manually on the header.php file but it goes to the end of the menu and does not look like a pretty solution.

Any ideas? Using latest Wordpress 3.2

标签: php wordpress
1条回答
迷人小祖宗
2楼-- · 2019-05-07 09:30

If you only want to hide it to the users, i suggest using the following CSS:

body.home a[title="Home"] {
    display: none;
}

Explanation: Wordpress generates several classes for the body tag. The home class is used to hide all links with the title Home on the homepage.

Working Example (code taken from the default theme): http://jsfiddle.net/yJVyK/1/

Note: The attribute selector does not work in IE6

查看更多
登录 后发表回答