PHP Function to write before something [HELP]

Discussion in 'PHP' started by gamestrolley, May 20, 2010.

  1. #1
    Hey guys, I am making a free wordpress plugin. and i need to edit the single.php file for single posts.
    and i want to know how to do:

    write:(code) before:(thecontent)

    what would the php code be?

    i have looked everywhere but couldn't find it.

    http://www.webmastershelpguide.com/ :cool:
     
    gamestrolley, May 20, 2010 IP
  2. ivan.kristianto

    ivan.kristianto Active Member

    Messages:
    136
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    My suggestion is just write your code before the_content() function called.
     
    ivan.kristianto, May 20, 2010 IP
  3. gamestrolley

    gamestrolley Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want to edit the file in wordpress called single.php and add my own php before the <thecontent> tag without changing any other customiseations the user may have, and ideas what the code would be?
     
    gamestrolley, May 20, 2010 IP
  4. musicmasteria

    musicmasteria Peon

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Are you trying to edit the content that is being displayed?

    It is very bad practice for any plugin to make permanent changes to theme files (or any files for that matter).

    If you are wanting to change/filter the output of the_content() you should look into Wordpress Filters (Plugin API) here:
    http://codex.wordpress.org/Plugin_API/Filter_Reference

    Or if you want some code to be called every time before the_post() you should look into Wordpress Actions here:
    http://codex.wordpress.org/Plugin_API/Action_Reference

    I believe you should rethink the way you want your plugin to work before continuing development.
     
    musicmasteria, May 20, 2010 IP
  5. gamestrolley

    gamestrolley Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks, that was a really helpful post!
     
    gamestrolley, May 21, 2010 IP