nutsmuggler
Member
Posted 6 years ago #
Hi folks.
I am building a plugin, and I am trying to keep all my stuff in a single file.
I would like to stop the wp loop before it shows the posts: basically the wp engine should load the header, the upper bar but then stop and let me insert my html code.
I cannot find a suitable hook; any suggestion?
Cheers,
Davide
baptiste
Member
Posted 6 years ago #
Won't the 'the_content' filter hook do what you need?
From the Codex:
http://codex.wordpress.org/Plugin_API#Current_hooks_for_filters
the_content - applied to post content prior to rendering. Passed the content as a string.
and then just prepend your HTML to $content?
function foo_bar ($content = '') {
return $your_custom_html . $content;
}
add_filter('the_content', 'foo_bar');
Or did you want to do something different?
nutsmuggler
Member
Posted 6 years ago #
Thanks a million!
This was exactly what I was looking for.
Cheers,
Davide