- This topic has 16 replies, 5 voices, and was last updated 5 years, 10 months ago by Leo.
-
AuthorPosts
-
July 28, 2017 at 2:52 am #356175Christian
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
July 28, 2017 at 9:31 am #356303TomLead DeveloperLead DeveloperHi there,
What do you mean by start pages? We’d need to be more specific.
Maybe you only want them on single posts?
July 29, 2017 at 1:37 am #356577ChristianHi 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 subCI 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
July 29, 2017 at 10:21 am #356732TomLead DeveloperLead DeveloperTry this:
<?php if ( function_exists( 'yoast_breadcrumb' ) && is_singular() ) { yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ); } ?>
September 12, 2017 at 7:01 am #383873EspressoHI 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,
DanSeptember 12, 2017 at 2:17 pm #384219TomLead DeveloperLead DeveloperWhat 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.September 12, 2017 at 2:34 pm #384229EspressoHi 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
DanSeptember 12, 2017 at 8:46 pm #384334TomLead DeveloperLead DeveloperI 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
September 18, 2017 at 3:34 am #387257EspressoOk 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; ?>September 18, 2017 at 5:01 am #387285EspressoThis 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; ?>
}September 18, 2017 at 8:55 am #387416TomLead DeveloperLead DeveloperThis 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; ?>
September 18, 2017 at 12:19 pm #387548EspressoThanks a lot Tom! 🙂
September 18, 2017 at 7:08 pm #387699TomLead DeveloperLead DeveloperYou’re welcome 🙂
May 7, 2018 at 5:53 am #569551LeoHi!
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! 🙂
May 7, 2018 at 8:27 am #569799LeoStaffCustomer SupportThe same structure here should work: https://generatepress.com/forums/topic/breadcrumbs-by-yoast-how-to-exclude-particular-pages/#post-387416
Just need
!
beforeis_page
-
AuthorPosts
- You must be logged in to reply to this topic.