WordPress.org

Ready to get started?Download WordPress

Forums

Inserting code just before <?php comments_template();? >? (6 posts)

  1. VitaeBlog
    Member
    Posted 5 years ago #

    I'm working on a plugin and was wondering how I could insert code into wordpress (such as html, php, etc, etc) just before <?php comments_template(); ?> is called by the theme?

  2. VitaeBlog
    Member
    Posted 5 years ago #

    bump??

  3. t31os
    Member
    Posted 5 years ago #

    You're not being very helpful in describing what you want to do exactly...

    Hi i'm some text before the comments template...?
    <?php comments_template(); ?>
    <p>Hi i'm some text in a paragraph tag before the comments template function.</p>
    <?php comments_template(); ?>

    ?

  4. VitaeBlog
    Member
    Posted 5 years ago #

    Hi t31os,

    At its core I want to do this:

    <?php include='someurl'; ?>
    <?php comments_template(); ?>

    So basically call <?php include='sumeurl'; ?> before <?php comments_template(); ?> but do it via a plugin rather than manually inserting it into every theme.

  5. VitaeBlog
    Member
    Posted 5 years ago #

    Still no ideas?

  6. t31os
    Member
    Posted 5 years ago #

    I've not written plugins myself, i always use theme functions. I wouldn't be able to advise on how to correctly and safely hook into themes via a plugin.

    If you get a nice straight-forward answer to the question i'll be interested to see it to.

    Of course the easy way would be to find a basic plugin (something with a few lines of code only), rip the code from it and modify as needed.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.