Black Friday Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] breadcrumbs by yoast > how to exclude particular pages?

Home Forums Support breadcrumbs by yoast > how to exclude particular pages?

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #356175
    Christian

    Dear Support Team,

    I am using Yoast breadcrumb functionality with GP 1.3.48.
    I want to exclude the breadcrumbs from showing up on first level pages like the “home” or “start” pages.
    I tried several solutions from this forum but without luck and would be very happy if you could help me with the code.
    I use the following code in the hook premium plugin in “inside content container”
    ————————————
    <div style=”font-size:12pt;

    <?php
    if ( function_exists(‘yoast_breadcrumb’) ) {
    yoast_breadcrumb(‘
    <p id=”breadcrumbs”>’,'</p>
    ‘);
    }
    ?>

    ————————————

    Thank you for your support, Best, Chris

    GeneratePress 1.3.48
    #356303
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What do you mean by start pages? We’d need to be more specific.

    Maybe you only want them on single posts?

    #356577
    Christian

    Hi Tom,
    thank you for your reply.

    My “first level navigation” looks like:

    Start Main1 Main2 Main3 Main4 Each “Main” might have sublevels like:
    sub1 subA
    sub2 subB
    sub3 subC

    I only want to see the breadcrumbs on the sub-levels and not on the main level.

    It is not around only seeing them on single posts – but on single pages (which might be the same in terms of code??)

    If you need to look at the particular website: https://zenhub.org

    Hopefully I was able to clarify more, thank you for your help and consideration, Best, Chris

    #356732
    Tom
    Lead Developer
    Lead Developer

    Try this:

    <?php if ( function_exists( 'yoast_breadcrumb' ) && is_singular() ) {
        yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );
    } ?>
    #383873
    Espresso

    HI Tom,

    I would like to achieve this as well. Show breadcrumb only on second and third level pages and not first level. If I use the code you provided, it shows the breadcrumbs everywhere and stop the scrolling function.

    Website: http://www.espressotranslations.com

    Best,
    Dan

    #384219
    Tom
    Lead Developer
    Lead Developer

    What do you mean by first level? The code above will only display them on single pages.

    If you want the breadcrumbs inside your sticky header, you’ll want to include the code inside of your closing custom-fixed-header </div> element.

    #384229
    Espresso

    Hi Tom,

    What I want to achieve is to exclude breadcrumbs when you are on the primary navigations pages. I want them to be displayed only when you are on subpages (pages inside the drop down menu under the arrows)

    Thanks
    Dan

    #384334
    Tom
    Lead Developer
    Lead Developer

    I don’t think there’s a conditional that can do that.

    You would have to manually enter the page IDs you want to include it one:

    if ( is_page( array( 10, 12, 18, 20 ) ) ) {
        // Breadcrumb code in here
    }

    10, 12, 18 and 20 being the page IDs

    #387257
    Espresso

    Ok thanks. Where do I have to add this code?

    Also, do I have to delete some code that I already have?

    This is what I have now:

    <?php if ( ! is_front_page() ) : ?>
    <?php if ( function_exists(‘yoast_breadcrumb’) ) { ?>

    <?php yoast_breadcrumb(‘<p id=”breadcrumbs”>’,'</p>’); ?>

    <?php } ?>
    <?php endif; ?>

    #387285
    Espresso

    This is the code I added but it seems still to show on all pages:

    if ( is_page( array( 637 ) ) ) {
    <?php if ( ! is_front_page() ) : ?>
    <?php if ( function_exists(‘yoast_breadcrumb’) ) { ?>

    <?php yoast_breadcrumb(‘<p id=”breadcrumbs”>’,'</p>’); ?>

    <?php } ?>
    <?php endif; ?>
    }

    #387416
    Tom
    Lead Developer
    Lead Developer

    This would be your code:

    <?php if ( function_exists('yoast_breadcrumb') && ! is_front_page() && is_page( array( 637 ) ) ) : ?>
        <?php yoast_breadcrumb( '<p id=”breadcrumbs”>','</p>' ); ?>
    <?php endif; ?>
    #387548
    Espresso

    Thanks a lot Tom! 🙂

    #387699
    Tom
    Lead Developer
    Lead Developer
    #569551
    Leo

    Hi!

    I have set up breadcrumbs with the Yoast plugin. Then I used GP Hooks and the following code for displaying breadcrumbs everywhere except on the homepage, and it works fine:

    <?php if ( ! is_front_page() ) : ?>
    <?php
    if ( function_exists(‘yoast_breadcrumb’) ) {
    yoast_breadcrumb(‘
    <p id=”breadcrumbs”>’,'</p>
    ‘);
    }
    ?>
    <?php endif; ?>

    But I have created a new landing page, and I want to exclude breadcrumbs also on such page.

    How should I modify the above-mentioned code for displaying breadcrumbs on the whole site EXCEPT on the homepage and the landing page?

    (The id of the landing page is 8191, and the site I’m working on is rusketa.com)

    I love GeneratePress, many thanks for your work and assistance! 🙂

    #569799
    Leo
    Staff
    Customer Support
Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.