0

I just spend a few hours trying to make my code look better. In the past, I did some changes using Wordpress code editor and after downloading these files yesterday, I noticed that code is totally messed up.

This is how code looks in the editor: enter image description here

And this is how it looks in browser:

enter image description here

Needless to say, it's very annoying. Now I can't inspect given element in Chrome because it's giving mi false line number in code. Any ideas what can I do with this?

6
  • 2
    It may be annoying but it shaves off the needless bytes and increases download speeds. Except for the final semi-colon that is. – Twifty Sep 20 '13 at 12:49
  • I know, but during the time when I was saving files locally and then uploading it to the server everything was fine. Now code is messed up and I can't edit it easily :/ – Adam W Sep 20 '13 at 12:56
  • TBH, you should have a mirror of your site stored locally this way you can quickly fix issues. Does it also strip the comments? – Twifty Sep 20 '13 at 13:03
  • 1
    Does code look compressed in WP editor now? Caching plugins like to minify code at output. – Rarst Sep 20 '13 at 13:14
  • In WP editor it looks almost identically as in the browser screenshot. I don't use any caching plugins on this site. – Adam W Sep 20 '13 at 13:17
2

This isn't as good as line numbers but you can add a dummy class every so often.

#_________section_1 {
    display: none; /* Just in-case it strips the empties */
};

It may help you to quickly scroll to the relevant section. To be honest though, you should have a mirror of your site stored locally and only change the online version when you're 100% satisfied.

4
  • Thank you for your suggestion. Yes, I have original file on hard drive, but it's outdated and I must do couple of changes. I was just looking for a simple solution to convert messed up by Wordpress file ;) – Adam W Sep 20 '13 at 13:08
  • If you just want to convert then use a text editors search and replace. search = '{' replace = '{\n' etc. – Twifty Sep 20 '13 at 13:21
  • This is exactly what I have done. Code that you are seeing on screenshoots is already after some corrections, one of them was '{\n' in Notepad++. – Adam W Sep 20 '13 at 13:25
  • The problem is - I can load old files, but I did some changes since them and having messed up file it will be difficult to even see changes and compare them. – Adam W Sep 20 '13 at 13:42
0

I'd recommend to use Notepad++ with built-in FTP connection (built-in nppFTP addon). It made my life easier after I've started using that. Never touched WP-EDITOR already for years now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.