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

Home Forums Support [Resolved] hide breadcrumbs on start page (with sections) but show categories on posts

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

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #171817
    Sven

    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

    #171862
    Tom
    Lead Developer
    Lead Developer

    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 } ?>
    #172104
    Sven

    Awesome! 🙂

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

    Kind regards from Germany,
    Sven

    #172129
    Tom
    Lead Developer
    Lead Developer

    You’re very welcome 🙂

    #262088
    etevi
    <?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!

    #262199
    Tom
    Lead Developer
    Lead Developer

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

    #262261
    etevi

    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

    #262441
    Tom
    Lead Developer
    Lead Developer

    Replace:

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

    With:

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

    #262482
    etevi

    After replacement stopped working breadcrumbs.

    #262631
    Tom
    Lead Developer
    Lead Developer

    Can you show me your full code?

    #262688
    etevi

    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.

    #262770
    Tom
    Lead Developer
    Lead Developer

    Looks fine to me. Is “Execute PHP” checked?

    #262844
    etevi

    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.

    #262990
    Tom
    Lead Developer
    Lead Developer
    #263064
    etevi
Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.