How To Make Money With Your Blogs!

BlogForumManagerReportsVideosPluginsDownloadsHelp

How To Edit WordPress Theme Files Without Problems

by David Pankhurst - May 8, 2008

There’s a big difference between writing an article in WordPress, and writing code (like editing a WordPress theme).

The difference is that most programming languages use a limited character set, with very specific meanings. However, writing can be ’sloppy’ in a way that computers simply can’t tolerate.

For example, the following text looks about the same to the eye, but a fussy computer would choke on the second one (and they are all fussy):

$x="example text string";
$x=“example text string”;

The second line would break in a program because of the quotes.

In writing, these are called typographic quotes - and WordPress (and word processors like Word and OpenOffice) tend to use them, and adjust the ‘regular’ ones to fit. However, computers need those regular kinds, and ONLY those.

Another problem is lines. Word processors work with paragraphs - computers work with lines. The difference is when you have a long line in your editor; a word processor will ‘wrap’ it down to the next line, while a text editor will let the lines go off the right edge. Visually, it’s much easier to work in computer code that way, and less chance of mistakes

So, Open Office and Word (and Window’s WordPad) are no good - what then can you use?

One standby in every Windows computer is Notepad. However, some files will cause little boxes to appear when you edit - these boxes are due to Notepad not being able to handle the file properly. The reason has to do with how files internally handle the break to the next line of text; suffice to say, if you try to edit a file from a website in Notepad, you’ll often get this problem.

Instead, I recommend a full-fledged programmer’s editor; specifically, the free PSPad. I’ve been using it for some years now, and it manages the details of working with PHP files well (among other things).

It’s also handy for text chores I have. For example, If I have a list with a lot of blank lines, I can remove them by loading it into PSPad and then use the menu option Edit; Lines Manipulation; Remove Blank Lines. I can also sort lists (Edit; Sort).

Another feature is the ability to search and replace with something called regular expressions. While regular expressions are not for the faint of heart, if you’re already familiar with them, PSPad makes it very easy to perform jobs that would be painful otherwise, such as inserting text in the front and back of every line, or converting lines from one style to another (for example, converting a comma separated list into an HTML list).

So if you’re thinking of doing a little WordPress theme or template fiddling, consider a good text editor, and get up to speed on it - you’ll quickly see the benefits from it!


ActiveBlogging.com - for information on making your blog successful! Get information like this - and more - inside! Details here or Join Today!

Comments are closed.