如果是“home",则删除面包屑在 wordpress 中 [英] Remove breadcrumbs if "home" in wordpress

查看:31
本文介绍了如果是“home",则删除面包屑在 wordpress 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 header.php 中有面包屑功能.我不想让面包屑出现在我的主页上,但我希望它出现在所有其他页面上.请帮助我如何实现这一目标.

在标题中显示面包屑的函数是:

解决方案

好的,我设法解决了这个问题..

我用

替换了我的标题的body标签

这对我的 css

body#homepage#breadcrumbs {visibility: hidden;}意思是如果当前页面是首页,则不会显示面包屑.

I have the breadcrumbs function in my header.php. I don't want to the breadcrumbs to appear on my homepage but all other pages I want it to appear. Please help in how I can achieve this.

The function to display the breadcrumbs in the header is:

<div id="breadcrumbs" class="container">
<div class="row">
    <?php breadcrumb_trail( array(
        'separator' => '&raquo;',
        'before' => '',
        'show_home' => '<img src="' . get_template_directory_uri() .    '/images/breadcrumb-home.png" />',
    ) ); ?>
</div>
</div>

解决方案

Ok i managed to solve this..

I replaced the body tag of my header with

<body<?php if(! is_home()) echo ' id="homepage"';?>>

and this to my css

body#homepage#breadcrumbs {visibility: hidden;}meaning that if the current page is the homepage, the breadcrumbs will not be shown.

这篇关于如果是“home",则删除面包屑在 wordpress 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆