659 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 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)...

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by