- This topic has 9 replies, 5 voices, and was last updated 6 years, 1 month ago by
Leo.
-
AuthorPosts
-
July 2, 2018 at 2:01 am #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
July 2, 2018 at 4:31 am #613243David
StaffCustomer SupportHi 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; }July 3, 2018 at 4:54 am #614195Huy
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
July 3, 2018 at 5:33 am #614239David
StaffCustomer SupportOK, 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' );July 3, 2018 at 8:09 pm #614827Huy
Thank you, David
It works for me!
Regards
July 4, 2018 at 2:29 am #614978David
StaffCustomer SupportYou’re welcome
October 1, 2019 at 7:31 am #1023327Slawomir
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
SlawekOctober 1, 2019 at 7:44 am #1023340David
StaffCustomer SupportHi there,
could you start a new topic where you can provide a link to your site so i can take a look.
January 23, 2020 at 3:52 pm #1142044Matt
Where does that code go? I used the Yoast shortcode to add the breadcrumbs, now trying to remove the post title from the breadcrumbs.
January 23, 2020 at 4:19 pm #1142058Leo
StaffCustomer SupportThose are filters so one of these methods:
https://docs.generatepress.com/article/adding-php/ -
AuthorPosts
- You must be logged in to reply to this topic.