Home › Forums › Support › hide breadcrumbs on start page (with sections) but show categories on posts
- This topic has 15 replies, 3 voices, and was last updated 7 years, 3 months ago by Tom.
-
AuthorPosts
-
February 10, 2016 at 8:31 am #171817Sven
Hello Tom,
I’ve got sections on my start page (fudiggl.de) and I would like to show breadcrumbs at the very start of my content – but only on posts!
I use YoastSEO and in my content area I have hooked:
<?php if ( function_exists('yoast_breadcrumb') ) { ?> <div class="grid-container grid-parent"> <div class="page-header"> <?php yoast_breadcrumb('<p id="breadcrumbs">','</p>'); ?> </div> </div> <?php } ?>
but there’s missing the
if ( ! start page)
and I don’t know how to insert it!?Could you do me that favour as I see you know how to php…?
Best regards,
SvenFebruary 10, 2016 at 11:35 am #171862TomLead DeveloperLead DeveloperHi Sven,
To make it only show on posts you would do this:
<?php if ( function_exists('yoast_breadcrumb') ) { ?> <?php if ( is_single() ) : ?> <div class="grid-container grid-parent"> <div class="page-header"> <?php yoast_breadcrumb('<p id="breadcrumbs">','</p>'); ?> </div> </div> <?php endif; ?> <?php } ?>
February 11, 2016 at 9:19 am #172104SvenAwesome! 🙂
It’s not who you are, but who you know! Thanx a lot!
Kind regards from Germany,
SvenFebruary 11, 2016 at 11:22 am #172129TomLead DeveloperLead DeveloperYou’re very welcome 🙂
January 9, 2017 at 2:25 am #262088etevi<?php if ( function_exists('yoast_breadcrumb') ) { ?> <?php if ( is_single() ) : ?> <div class="grid-container grid-parent"> <div class="page-header"> <?php yoast_breadcrumb('<p id="breadcrumbs">','</p>'); ?> </div> </div> <?php endif; ?> <?php } ?>
Hi Tom. That finish the code to show more breadcrumbs on the pages? Thank you!
January 9, 2017 at 8:13 am #262199TomLead DeveloperLead DeveloperThat code will show breadcrumbs only on single posts. Where are you wanting them to show up?
January 9, 2017 at 9:47 am #262261eteviThat code will show breadcrumbs only on single posts. Where are you wanting them to show up
I want to see breadcrumbs on single posts and pages.
P.S. Sorry for my EnglishJanuary 9, 2017 at 8:40 pm #262441TomLead DeveloperLead DeveloperReplace:
<?php if ( is_single() ) : ?>
With:
<?php if ( is_single() || is_page() ) : ?>
January 10, 2017 at 12:35 am #262482eteviAfter replacement stopped working breadcrumbs.
January 10, 2017 at 10:01 am #262631TomLead DeveloperLead DeveloperCan you show me your full code?
January 10, 2017 at 11:52 am #262688eteviCan you show me your full code?
<?php if ( function_exists('yoast_breadcrumb') ) { ?> <?php if ( is_single() && is_page() ) : ?> <div class="grid-container grid-parent"> <div class="page-header"> <?php yoast_breadcrumb('<p id="breadcrumbs">','</p>'); ?> </div> </div> <?php endif; ?> <?php } ?>
Here’s.
January 10, 2017 at 6:43 pm #262770TomLead DeveloperLead DeveloperLooks fine to me. Is “Execute PHP” checked?
January 11, 2017 at 1:02 am #262844eteviLooks fine to me. Is “Execute PHP” checked?
Yes.
<?php if ( function_exists('yoast_breadcrumb') ) { ?> <?php if ( is_single() ) : ?> <div class="grid-container grid-parent"> <div class="page-header"> <?php yoast_breadcrumb('<p id="breadcrumbs">','</p>'); ?> </div> </div> <?php endif; ?> <?php } ?>
This code works for me.
January 11, 2017 at 9:28 am #262990TomLead DeveloperLead DeveloperMy mistake, just made an adjustment: https://generatepress.com/forums/topic/hide-breadcrumbs-on-start-page-with-sections-but-show-categories-on-posts/#post-262441
January 11, 2017 at 10:15 am #263064eteviMy mistake, just made an adjustment: https://generatepress.com/forums/topic/hide-breadcrumbs-on-start-page-with-sections-but-show-categories-on-posts/#post-262441
Everything works, thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.