659 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
luckykind says

I asked this question over in the actual tut, but not sure I’ll get an answer anytime soon as it’s almost 2 months old… so I’ll take a gander here…

Tut is here: Build a WordPress Plugin to Add Author Biographies to your Posts

To sum up the tut and what the problem is, The tut adds an Author Bio on to the end of the content like so (the short version):

function x($content) {
     return $content . "Author Bio";
}

add_action('the_content','x');

The Problem:

When someone uses:
$z = apply_filters('the_content', 'some content here');
echo $z;

The Author Bio will end up applied to $z and if $z is echoed out in the middle of some page… the Author Bio would be in the middle of some page… correct? (it’s correct because I’ve tested it…)

Is there a better way to apply something to the end/under/below the_content hook? other than add_action(‘the_content’, ‘some_function’) because this to me seems evil…

or is apply_filters(‘the_content’, ‘some content here’) not the norm or something developers shouldn’t be using inside their WordPress templates…? (which seems pretty much the norm, at least upon Google-ing formatting “the_content” outside the loop)...

by
by
by
by
by
by