WordPress.org

Ready to get started?Download WordPress

Forums

Showing some content instead of the posts (3 posts)

  1. nutsmuggler
    Member
    Posted 8 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

  2. baptiste
    Member
    Posted 8 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?

  3. nutsmuggler
    Member
    Posted 8 years ago #

    Thanks a million!
    This was exactly what I was looking for.
    Cheers,
    Davide

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.