Site logo

Archived topic

hide breadcrumbs on start page (with sections) but show categories on posts

15 replies · Started by Sven on February 10, 2016

Viewing posts 1–15 of 16

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,
Sven

Hi 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 } ?>

Awesome! :-)

It's not who you are, but who you know! Thanx a lot!

Kind regards from Germany,
Sven

You're very welcome :)

<?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!

That code will show breadcrumbs only on single posts. Where are you wanting them to show up?

That 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 English

Replace:

<?php if ( is_single() ) : ?>

With:

<?php if ( is_single() || is_page() ) : ?>

After replacement stopped working breadcrumbs.

Can you show me your full code?

Can 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.

Looks fine to me. Is "Execute PHP" checked?

Looks 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.

This archived topic is closed to new replies.