blondie53185
Member
Posted 4 months ago #
I am using the Breadcrumb NavXT plugin and have successfully modified the header.php in my child theme for Twenty Eleven so that the trail does not display on the front page using:
<div id="main">
<div class="breadcrumbs">
<?php if(function_exists('bcn_display') && !is_front_page())
{
bcn_display();
}?>
</div>
[Please post code snippets between backticks or use the code button.]
Please tell me how I would modify this code so that the breadcrumb trail doesn't display on two of my landing pages also. I have no php experience but can follow directions very well.
Thanks!
http://wordpress.org/extend/plugins/breadcrumb-navxt/
If you're looking to exclude specific pages, I would just do something like:
<?php if(function_exists('bcn_display') && !is_front_page() && $post->ID != XX)
{
bcn_display();
}?>
where XX is the ID of the page you want to exclude. Just add an additional && $post->ID != XX for each page. You could also use $post->post_name != 'my-post-slug' and exclude pages by slug.
blondie53185
Member
Posted 4 months ago #
Thank you so much - this one was easy to figure out where the code goes because you showed a little bit of my existing code. Excellent instructions!!
Do not check $post->ID explicitly, it isn't something you should rely on. Use the WordPress conditionals (see http://codex.wordpress.org/Conditional_Tags ) instead. E.g. use:
<div id="main">
<div class="breadcrumbs">
<?php if(function_exists('bcn_display') && !is_front_page() && !is_page(xx))
{
bcn_display();
}?>
</div>
where xx is the ID of the page, or the slug for the page.