• astereo

    (@astereo)


    Hello all. I’m trying to create my first plugin – a plugin version of my market theme. I have never created a plugin before and I’m not good with php (other than wordpress stuff), but I do know how to read tutorials. I’ve found plenty that show you how to add additional content to the end / beginning of a post (such as a sentence wrapped in paragraph tags), but I need something a little beyond that.

    What I want to do is have a <form> code generated and added to the end of each post which will lead to a paypal buy now button. Everytime I try putting a form code in place of the paragraph tags from tutorials, it causes the plugin to break and it obviously doesn’t get activated. I’m not sure if this is just because it won’t accept the form code, or because I am using custom fields in the form code (one echos the price set in a custom field to set the buy now button price, email email is called from the admin email specified in wordpress, etc).

    Can this be done and can anyone point me in the right direction? If not, I’ll gladly pay someone to do it if they are interested.

    Please let me know as soon as possible.
    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • pipelineae

    (@pipelineae)

    Since the form tag obviously has attributes set, are you using the correct quotes (ie: ” and ‘).

    You need to alternate them in php. Like this:
    echo '<form action="something.php">';
    However, if you try something like the following, php will error:
    echo '<form action='something.php'>';
    In the 2nd example, the parser gets to the second apostrophe and thinks the echo is finished, but there’s no semicolon so it errors.

    If you are left in a situation where you HAVE to use the same quote that you used to open the echo, escape it with the backslash, that way php knows to ignore it.
    echo '<form action=\'something.php\'>';is functionally the same as echo '<form action="something.php">';

    The same goes for any php function.

    Hope that helps.

    your the man!! I need help on mine.. https://www.desiregoji.com

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help creating first plugin’ is closed to new replies.