[Support request] How to hide the Title part in the Breadcrumb (I'm using Yoast SEO)

Home Forums Support [Support request] How to hide the Title part in the Breadcrumb (I'm using Yoast SEO)

Home Forums Support How to hide the Title part in the Breadcrumb (I'm using Yoast SEO)

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #613179
    Huy

    Hi

    I am using Yoast SEO and to show breadcrumb, I use this code

    <?php if ( is_single() && ! is_single(3479) && ! is_single(4347) ) : ?>
         <div class="page-header grid-container grid-parent">
    <?php if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('<p id="breadcrumbs">','</p>');
    } ?>
    </div>
    <?php endif; ?>

    And this is the result: http://prntscr.com/k1il7t

    However, I don’t want to display the title of the post/page, I just want to show “Home >> Smoking”. Is there any way to do it without using CSS to hide it away. In another way, I want that title will not be generated.

    Thank you so much

    #613243
    David
    Staff
    Customer Support

    Hi there,

    you can use this filter for that:

    add_filter( 'wpseo_breadcrumb_links', 'db_wpseo_breadcrumb_links' );
    function db_wpseo_breadcrumb_links( $links ) {
    	if( sizeof($links) > 1 ){
    		array_pop($links);
    	}
    	return $links;
    }

    Adding PHP

    #614195
    Huy

    Hi David

    Thank you for your help

    I added that PHP code then this is the result: http://prntscr.com/k2038z

    However, I want the category (smoking) is a link, not just a text. There’s any way for me to do it?

    Thank you so much

    #614239
    David
    Staff
    Customer Support

    OK, try this:

    function remove_breadcrumb_title( $link_output) {
    	if(strpos( $link_output, 'breadcrumb_last' ) !== false ) {
    		$link_output = '';
    	}
       	return $link_output;
    }
    add_filter('wpseo_breadcrumb_single_link', 'remove_breadcrumb_title' );
    #614827
    Huy

    Thank you, David

    It works for me!

    Regards

    #614978
    David
    Staff
    Customer Support
    #1023327
    Slawomir

    Hello David,

    how can I hide breadcrumb’s title (Yoast) on mobile devices ONLY (screen-size <769px)? The breadcrumb’s are to long on the mobile devices.
    The function is realized exactly at Yoast-Blog:

    On mobile:
    Home >> Category1 >> Category2 >>
    <h1>Long-tail titel</h1>

    On Desktop:
    Home >> Category1 >> Category2 >> Long-tail titel
    <h1>Long-tail titel</h1>

    Thank you very much
    Slawek

    #1023340
    David
    Staff
    Customer Support

    Hi there,

    could you start a new topic where you can provide a link to your site so i can take a look.

    #1142044
    Matt

    Where does that code go? I used the Yoast shortcode to add the breadcrumbs, now trying to remove the post title from the breadcrumbs.

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