Well, removing autop
filter from the_content
filter tag makes no sense here, because you never apply the_content
filters in your code…
Let’s take a look at the source code of the_content()
function:
function the_content( $more_link_text = null, $strip_teaser = false) {
$content = get_the_content( $more_link_text, $strip_teaser );
$content = apply_filters( 'the_content', $content );
$content = str_replace( ']]>', ']]>', $content );
echo $content;
}
As you can see, it applies the_content
filter to the result of get_the_content()
function.
So how your function should look like?
function yb_link_post() {
$link_post_title="<strong class="headline"><a href="" . get_permalink() . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a></strong>';
$link_post_content = $link_post_title . ' — ' . get_the_content();
// you don't have to remove autop filter if you want to run it anyway... and content is already modified, so it will be `autop`ed correctly.
$content = apply_filters('the_content', $link_post_content);
$content = str_replace( ']]>', ']]>', $content );
echo $content;
}
PS. You shouldn’t use <b>
– use <strong>
instead. Also you should escape eveything correctly (i.e. if you print get_the_title()
as html attribute, you should run esc_attr
on it).