• Resolved Hypno_Pboro

    (@hypno_pboro)


    I have some landing pages on my website https://www.cleanerstogo.co.uk and I don’t want to show breadcrumbs on them and although this problem was successfully resolved here …

    https://www.ads-software.com/support/topic/remove-breadcrumbs-from-pages-only/

    I am unsure how to use the code that was provided.

    Here’s what was written,

    <?php if(function_exists(‘bcn_display’) && !is_page()){ ?>
    <div class=”breadcrumbs” typeof=”BreadcrumbList” vocab=”https://schema.org/”&gt;
    <?php bcn_display(); ?>
    </div>
    <?php } ?>

    I know the page-id for the landing pages as this method worked to stop the main menu appearing on them (adding CSS to my child them) so I imagine I will insert their id’s somehow here too.

    Any suggestions gratefully accepted.

    • This topic was modified 7 years, 5 months ago by Hypno_Pboro.
    • This topic was modified 7 years, 5 months ago by Hypno_Pboro.
    • This topic was modified 7 years, 5 months ago by Hypno_Pboro.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author John Havlik

    (@mtekk)

    You should be able to pass in either a single page ID or an array of page IDs into is_page(). See https://developer.www.ads-software.com/reference/functions/is_page/ for more details.

    Thread Starter Hypno_Pboro

    (@hypno_pboro)

    @mtekk , thanks for the reply but I think I’m still stuck on something basic.

    I make all my changes using the child theme and have, for example used this code to remove the main menu from one of the pages in question.

    .page-id-21 .main-navigation {
    display: none;
    }

    When I added the below coding to the child theme nothing changed.

    <?php if(function_exists(‘bcn_display’) && !is_page( 5091 )){ ?>
    <div class=”breadcrumbs” typeof=”BreadcrumbList” vocab=”https://schema.org/”>
    <?php bcn_display(); ?>
    </div>
    <?php } ?>

    Is it that I have to alter the code to reflect it’s in the child theme rather than input in the main theme?

    Perhaps there’s a way using something akin to

    .page-id-21 .BreadcrumbList {
    display: none;
    }

    Which I tried but clearly wasn’t correct.

    • This reply was modified 7 years, 5 months ago by Hypno_Pboro.
    • This reply was modified 7 years, 5 months ago by Hypno_Pboro.
    Plugin Author John Havlik

    (@mtekk)

    If you want to use CSS, then you need to target the CSS class of the div wrapping the breadcrumb trail. For the standard Breadcrumb NavXT calling code, you’d want:

    .page-id-21 .breadcrumbs {
    display: none;
    }

    Also, note that it appears the ID for the post/page in question is 21 (if the CS worked for the main navigation), not 5091 as what you had used in your is_page() call.

    Thread Starter Hypno_Pboro

    (@hypno_pboro)

    @mtekk, thanks for the CSS as I was unsure the correct name for the breadcrumbs (obvious, really, in hindsight!) & as I’ve got a few landing pages both page-id’s were correct so I’d left that unchanged in my previous post.

    But I still haven’t been able to remove the breadcrumb trail from those pages.

    For example, I’m using the three following pieces of code (with the page-id replaced for each page)

    .page-id-21 .breadcrumbs {
    display: none;
    }

    .page-id-21 .main-navigation {
    display: none;
    }

    .page-id-21 #st-footer-menu.menu {
    display: none;
    }

    That code removes the two menus but not the breadcrumbs

    Could it be that another plug-in is interfering with this (unlikely I’d imagine, since the breadcrumb works perfectly as it’s intended at the moment)?

    Thank you for your suggestions on this.

    Plugin Author John Havlik

    (@mtekk)

    Have you tried using your web browser’s built in inspector to see what CSS is being applied to the breadcrumb trail? Also, check to ensure Breadcrumb NavXT is the one generating the breadcrumb trail (viewing the HTML source of the file should help with this). If you by chance have a live version of this site that I can look at, I may be able to give you more insight into what’s going on.

    Thread Starter Hypno_Pboro

    (@hypno_pboro)

    @mtekk, thx for the suggestions & will check as you advised.

    The website is https://www.cleanerstogo.co.uk

    No breadcrumbs were showing until I installed the plugin so I don’t know whether there’s another way the breadcrumbs were being created prior to that and the plugin is just making those appear.

    I’ll see what I can dig up.

    Thx

    Plugin Author John Havlik

    (@mtekk)

    Looking at the site you linked to, the surrounding div for the breadcrumb trail looks to be:
    <div id="breadcrumbs">
    which is missing the schema.org BreadcrumbList definition, it is also using the id of breadcrumbs rather than the class of breadcrumbs. This may be part of your problem.

    .page-id-21 #breadcrumbs {
    display: none;
    }

    Will probably work for you, but I do suggest using the “proper” calling code so that Google and other search engines detect your breadcrumb trail properly.

    Where in your theme/child theme are you placing the calling code?

    Thread Starter Hypno_Pboro

    (@hypno_pboro)

    @mtekk, thank you for your reply and yes, your suggestion did work for the pages in question.

    My knowledge of WordPress is rather ad-hoc so quite probably some of my CSS in the child-theme stylesheet.css may not be the most effective way to get things done, but I’m learning as I go.

    I have posted a question about breadcrumbs in the group for the theme I use and I’m waiting to see if anyone else has picked up on how to deal with this more efficiently.

    I’ll mark this as closed since it’s all up and running now as I wanted.

    Thanks for your help.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to remove breadcrumbs from landing pages?’ is closed to new replies.