WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Best way to copy and paste code? (10 posts)

  1. Michael Bishop

    Posted 9 years ago #

    I've tried a few plugins recently that when I copied and pasted the code to an editor, then uploaded it to the plugins folder, the header info runs into the real code, basically showing the whole script on the plugin page. Obviously I'm doing something wrong when I paste the code, but I don't know what it could be. Any insight would be great.

  2. dommega
    Member
    Posted 9 years ago #

    Instead of copying and pasting the code:
    1. Right click on the Link of the Plugin
    2. Go to Save As...
    3. Save the File
    4. Put the saved file in your plugins folder

  3. Michael Bishop

    Posted 9 years ago #

    That worked, but I'd still like to know what I'm doing wrong when I cut and paste.

  4. dommega
    Member
    Posted 9 years ago #

    I have never experiences that problem before. Sorry.

  5. Lorelle
    Member
    Posted 9 years ago #

    What are you pasting into?

    Make sure that it is a text editor and not a word processor.

    Make sure there are no spaces before the <?php at the very start of the plugin.

    If you right click "File, Save As" or "Save Target As", the file may save as a PHPS file. You will need to make sure that you rename it PHP.

    And before right clicking and saving a plugin link, make sure it is a link to a phps or text file and not a zip. That can get messy. ;-)

    If it is a zip file, unzip it and just copy the plugin file directly to your plugin directory.

  6. Michael Bishop

    Posted 9 years ago #

    I know to use a bloody text editor, I used two different ones, both Smultron and Taco. Tried two different ways of copying the .txt file, tried unwrapping text, checked for spaces at the beginning and end.
    At least you didn't just copy and paste a link to the codex this time...

  7. Lorelle
    Member
    Posted 9 years ago #

    I think that this kind of response is unnecessary and unhelpful. The answer you were given was more than appropriate to help you and anyone else looking at the question two years from now. How would I personally know your level of expertise?

    We are all volunteers here and it makes it very difficult when honest and sincere help is offered and treated this way.

  8. Michael Bishop

    Posted 9 years ago #

    And not to get into a pissing contest, but I don't think your response was neccessary or helpful. My original post clearly uses the term "editor". At no point, did I say I had a problem "saving as", or that I didn't understand the concept. And since I find myself wanting to go off about issues unrelated to this thread, I will leave it at that.

  9. MattRead
    Member
    Posted 9 years ago #

    1. Did you save the file as .php and not .txt? (probably)

    2. did you save as plain text?

    3. did/can you save/upload as ASCII? and use LF instead of CRLF or CR?

  10. Michael Bishop

    Posted 9 years ago #

    #3 was it. In the preferences for Smultron (and I assume somewhere in Taco) there was the option for line endings and to use LF instead of CR. I had changed it in cyberduck, didn't think about it in Smultron.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic