How To Set Line Endings in Smultron for your WordPress Themes

About 5 minutes after releasing my first WordPress theme, Theseus, upon the world, I had my first support ticket to deal with: A Parse Error. The problem is, I work on a Mac and Macs handle line endings differently than everyone else. Different as in, make Unix computers explode. Unfortunately for me, a lot of web servers are UNIX computers. That explode.

About 5 minutes after releasing my first WordPress theme, Theseus, upon the world, I had my first support ticket to deal with. Check it out:

Thank you for this awesome theme, but it doesn’t seem to be working for me.

This is what it says after installing and testing it.

Parse error: syntax error, unexpected T_VARIABLE in /home/javitsin/public_html/wp-content/themes/theseus/index.php on line 1

Now a Parse Error happens when, essentially (I say essentially, not exactly, because I’m a designer not a programmer), you make a typing mistake in a PHP file. Thing is, I hadn’t made any typing mistakes—that I could see.

The problem is, I work on a Mac and Macs handle line endings, you know, where you press return, differently than everyone else. Different as in, make Unix computers explode. Unfortunately for me, a lot of web servers are UNIX computers. That explode.

If you’re using Smultron, the open-source Mac text editor, here’s how to fix your WordPress theme, changing Mac line endings to Unix line endings, and stop the explosions. Open the preferences pane and navigate to Open & Save. Down there at the bottom, tucked away neatly is the life or death Line Endings setting, probably set to “leave unchanged”. Change it to Unix.

Line Endings preferences for Smultron
And that’s it! No more explosions.

6 thoughts on “How To Set Line Endings in Smultron for your WordPress Themes”

  1. Thanks for the info Ian. I haven’t ran into this issue with any of my themes, but I will have to check my settings in Smultron. Smultron is my second favorite editor just behind Coda now!

  2. I use Smultron on my Mac for all my amateur attempts at web template design. I want to start creating WP templates and this little gem of advice has probably saved me from giving up before even getting started. Thanks for sharing.

Comments are closed.