Live data from Hacker News

Wordless: stop writing Wordpress themes like it's 1998.

github.com

51–60 of 87 posts

Re: Wordless: stop writing Wordpress themes like it's 1998.

#51
post #26

I feel this is solving a problem that doesn't exist. The problem with creating a WordPress theme isn't that it's missing buzzwordy tech like HAML, SASS and CoffeeScript. The problem is that the PHP behind WordPress is hideous. Even in version 3.x If someone were to fork WordPress and fix all the spaghetti code, then I could stop writing themes like it was 1998...

I've dived in the Wordpress codebase a few times, I think it wouldn't be very hard to rewrite major parts. However, I don't think you can fix much without breaking tons of plugins, themes and 3rd party tools that integrate with Wordpress. And if you are going to break the plugin ecosystem, might as well use Habari, which is much nicer: http://habariproject.org/en/ Too bad all the available plugins fit in a single pag…

+1 for habari, although lack of plugins is a bit of an issue when it comes to sites that need a lot more than just blog + static pages.

Re: Wordless: stop writing Wordpress themes like it's 1998.

#53
Cool. As someone doing heavy WordPress development (and will be doing even heavier dev. in the future) this is a step in the right direction.

The available tools for WordPress right now are just awful. I'm doing plugin development right now (but will get to themes in a couple of months); and in order to setup unit testing it took me a full 3 days.

When coding plug-ins, I noticed that I'm using awful and very old patterns (like mixing PHP with HTML). It's like I'm working on PHP when I was 15 years old. Checking a few WordPress plug-ins (popular and premium ones), it even proved to be worse: They were using procedural code and patterns. Huge and long code, a bunch of functions with long names binding to WordPress actions or filters.

Here are the improvements that I'm looking for (and working on):

1. Better Unit Testing: A better stack for Unit Testing.

2. Better debugging: Debugging is just a nightmare when doing WordPress development and your project (I'm using Netbeans) should point to your plug-in repository.

3. Developers plug-in: A plug-in to manage your WordPress install

4. Bootstrap plug-in: Administration interfaces (styles/tables/forms/buttons...)

EDIT: I just noticed that the following

  Include the assets in your Haml views using include_javascript() helper.

  = include_javascript("application")
  This will produce the following HTML, pointing to the assets/javascripts directory:

  
This is a very bad practice. You should use WordPress functions to queue scripts and styles.

Re: Wordless: stop writing Wordpress themes like it's 1998.

#54
post #40

>>Ability to write PHP code using the beautiful Haml templating system; >>Ability to write CSS stylesheets using the awesome Sass syntax [...]; >>Ability to write Javascript logic in Coffeescript; Some may like that, but I want to write my PHP in PHP, and write my CSS in CSS, and write my JS in JS. I really never got why I would write one language in another language just to then use some tool to translate it (and if…

Well, you are not writing PHP, CSS and JS. You are writing an application (or a part of it), and these higher level languages allow you do that more efficiently, that's all.

Re: Wordless: stop writing Wordpress themes like it's 1998.

#55
post #40

>>Ability to write PHP code using the beautiful Haml templating system; >>Ability to write CSS stylesheets using the awesome Sass syntax [...]; >>Ability to write Javascript logic in Coffeescript; Some may like that, but I want to write my PHP in PHP, and write my CSS in CSS, and write my JS in JS. I really never got why I would write one language in another language just to then use some tool to translate it (and if…

You can still write in your favorite language and benefit from the routing engine for example, although it's not quite developed and rich.

Re: Wordless: stop writing Wordpress themes like it's 1998.

#56
This is... impressive.

Not for me, though. When I got my current webcomic up and running I didn't even bother writing a custom theme like I did before - I just made a child theme of the Comicpress theme and started hacking away at the CSS.

It is inefficient, it is inelegant... but I got it up and running in a couple of days rather than a couple of weeks of tweaking the hell out of everything. Every now and then when the comic's being hard to write I procrastinate by tweaking the theme a little more.

I don't know if this means I'm a talentless hack or a pragmatic professional. Maybe some of both.

Then again I'm also not doing a crazy dynamic site that happens to be using Wordpress as its backend.

Re: Wordless: stop writing Wordpress themes like it's 1998.

#57
post #40

>>Ability to write PHP code using the beautiful Haml templating system; >>Ability to write CSS stylesheets using the awesome Sass syntax [...]; >>Ability to write Javascript logic in Coffeescript; Some may like that, but I want to write my PHP in PHP, and write my CSS in CSS, and write my JS in JS. I really never got why I would write one language in another language just to then use some tool to translate it (and if…

No, I think you're wrong. It's not for everyone but I highly recommend you look into one of these. I'd say look at LESS or SASS (they're basically the same) because that's what I'm most experienced with. Here's why it makes sense to use these languages:

First off, these languages help you write faster, and more efficiently. They mostly take a lot of the repetition and mental strain out of writing code. In my experience with LESS I'm always able to do things faster and don't have to remember color names or keep track of certain styles that I repeat many times especially if they include vendor prefixes.

Then once you've "compiled" the code it's the same as if you were to write it normally. Some may say "so what's the point then?" but again I must repeat that you are able to work more efficiently and still have yourself normal, totally compatible CSS, js, or HTML.

As far as performance goes, there really is no loss in performance as your abstracted code is compiled to the everyday kind with option to minify it too. I use LESS for all ky styling and on my Mac I use either Less.app or CodeKit which automatically detects changes to my .less files and compiles them on the fly to normal .css ones. The source of every page always asks for normal .css files and I really don't have to do any extra work besides making sure the app outputs my stylesheets in the right folder. As a bonus, CodeKit also minifies most languages, detects and syntax errors, and does some image optimization. On my Linux box, I just run a quick terminal command and the compiling takes a couple seconds. Barely any extra work at all.

The only time I'd see ant performance issues is if you were doing client or server side parsing/compiling of these abstraction languages in production. For example, you can use less.js and have your .less files linked in your HTML and it'll turn it into CSS on the fly. That would be a problem. Otherwise, as long as you're taking your HAML, CoffeeScript, LESS/SASS/SCSS, and whatever else and converting it to everyday js, CSS, and HTML then you have nothing to lose and everything to gain.

I used to believe like you that these superset languages were just a novelty and had no truly useful purpose. Then I tried LESS and still thought it was lame for a short time (I only grasped the concept of variables and thought the only benefit was being able to name colors) until I really understood it and now I can't live without it. Give one of these a try and I think you'll appreciate them.

Edit: I understand that not all of these work the same. For those that require server or client side parsing with no option to convert prior to production then you have a point. But most of these abstracted, superset languages can be compiled to normal CSS/HTML/js before production and those are the ones that are truly beneficial.

Re: Wordless: stop writing Wordpress themes like it's 1998.

#58

I feel this is solving a problem that doesn't exist. The problem with creating a WordPress theme isn't that it's missing buzzwordy tech like HAML, SASS and CoffeeScript. The problem is that the PHP behind WordPress is hideous. Even in version 3.x If someone were to fork WordPress and fix all the spaghetti code, then I could stop writing themes like it was 1998...

Exactly. I don't think that a re-write for WordPress will be the best solution for the moment as it'll wreak havoc on the thousands of themes and plug-ins that exists in the market.

I'm thinking of a theme framework that ease the theme creation process. It keeps you focused on doing what matters: putting the theme, CSS, HTML and JavaScript. Mainly there are three things to care about

- A routing engine. Similar to the Ruby routing engine. A plain and simple one.

- Views with a templating engine; and avoid the PHP/HTML mixing non-sense.

- A simple solution to create Admin panels on the fly.

I think this could serve as a solution for Theme Authors which helps them focus on the design rather than fight PHP loops and lookup WordPress functions.

Re: Wordless: stop writing Wordpress themes like it's 1998.

#59
post #35

This seems like an awful lot of extra layering on top of WP's horribly ugly theming system... And adding Ruby as a requirement? What about building on PHP-based tools like Assetic, or a cleaner template format? https://github.com/kriswallsmith/assetic I've never understood why people were willing to jump through so many hoops building themes in WP's messy way. As a comparison, here's a complete theme (based on the Tw…

It's not a horribly ugly theming system.

I'm mainly an HTML and CSS guy, and know a healthy amount of PHP.

But I don't know enough to set up a server, databases, write a CMS from scratch (well, maybe I could), and I don't like spending a lot of time in the Terminal. I'm not a programmer.

Even as a designer, I'm able to use WordPress' powerful theming system (which is pretty easy to understand and, in my opinion, not ugly at all) to build out an entire easy-to-use site for a client without having to also hire a developer. The WordPress community is massive and helpful, PHP is well-documented and simple to work with if you know HTML, and you can literally use WordPress to make almost anything on the web. Maybe it would be better theoretically to hire a developer or learn to be one, but I don't like hardcore programming and sometimes just don't need a developer that I have to pay for, wait for, etc.

WordPress, in a way, makes the ability to make simple web apps, dynamic sites, and blogs a more democratic thing; many people can pick enough WP knowledge in a few weeks to do things that would take months or years of programming training.

Re: Wordless: stop writing Wordpress themes like it's 1998.

#60
post #35

This seems like an awful lot of extra layering on top of WP's horribly ugly theming system... And adding Ruby as a requirement? What about building on PHP-based tools like Assetic, or a cleaner template format? https://github.com/kriswallsmith/assetic I've never understood why people were willing to jump through so many hoops building themes in WP's messy way. As a comparison, here's a complete theme (based on the Tw…

Just as an example, it is better to make an app like BaseCamp or Campfire with Ruby on Rails than WordPress. But I can learn enough in a matter of weeks to make something like the P2 Theme (http://www.p2theme.com) with WordPress; god knows how long it'd take me to go from completely zero programming knowledge to the level required to build the same thing in RoR
Post reply on HN