Hi Guys,
I copied the below snippet on how to “add sponsored post prefix to post tile” from: https://www.wpbeginner.com/wp-tutorials/how-to-add-sponsored-post-prefix-to-post-title-in-wordpress/
add_filter( 'the_title', 'wpb_sponsored' );
function wpb_sponsored( $title ) {
global $post;
$sponsored_text = '<span class="sponsored_text"> Sponsored Post</span> ';
$sponsored = get_post_meta($post->ID, 'sponsored', true);
if( $sponsored == 'true' && in_the_loop() ){
return $sponsored_text.$title;
}
return $title;
}
This is working, but the problem is that the “Sponsored” text which is in red is also visible in the breadcrumb. Can anyone assist with a solution not to show the “Sponsored” text in the breadcrumb but only on the “Title” itself?
Thanks
- This topic was modified 17 hours, 12 minutes ago by .
- This topic was modified 3 hours, 44 minutes ago by .
The page I need help with: [log in to see the link]