News for hackers. Stuff that matters.
Re:Why WordPress theming sucks by byoung2 on Wednesday September 22, 2010 @11:55AM (#1716536)
I bet the developers have thought of rewriting it using OOP and an MVC pattern, but all current plugins and themes would have to be rewritten as well. It's not so bad, since you'd only need the top few dozen plugins and themes rewritten to get traction.

I'd be willing to help out if anyone here is brave enough to try a rewrite!

Re:Why WordPress theming sucks by calvinf on Wednesday September 22, 2010 @12:35PM (#1716690)
WordPress is abandoning support for PHP4 and MySQL 4 in version 3.1. This will allow them to incorporate many of the features in PHP5 they haven't been able to do yet such as stronger OOP.

http://wordpress.org/news/2010/07/eol-for-php4-and-mysql4/

It doesn't need a rewrite. Instead, work with the many brilliant devs who have been improving it for years and know it inside-and-out -- including its flaws and areas for improvement.

Re:Why WordPress theming sucks by rickmb on Wednesday September 22, 2010 @03:38PM (#1717245)
Oh, come on. WordPress could have started providing a decent API eons ago. They don't care. Or they fundamentally don't see there's anything wrong with spaghetti code and inconsistent API's.

The only reason they are abandoning PHP4 because it has become so rare they can't test against it anymore, not because they want to improve anything. Remember this crap: http://ma.tt/2007/07/on-php/ ?

Which is typical for WordPress: one of the most successful companies to be built on PHP, and all they do is bitch about it and use their influence on a part of the community to hold it back instead of contributing, like Facebook, Digg and such.

Re:Why WordPress theming sucks by calvinf on Wednesday September 22, 2010 @03:59PM (#1717306)
As of writing this post, in WordPress's directory there are 11,351 plugins and 1,239 themes.

Source: http://wordpress.org/extend/

I'd call the API a success: it has thousands of authors releasing thousands of plugins and themes and this is only the code that's been released open-source.

Re:Why WordPress theming sucks by westi on Thursday September 23, 2010 @09:00AM (#1719441)
We have been providing a stable and reliable API for a long time.

Just because it doesn't look like how you envisage it should doesn't mean it doesn't exist.

Matt's post was true at the time and WordPress.org the open source project has never been "holding back the php community". Instead we have been ensuring that the most important people, our users, are able to upgrade reliably and easily on whatever hosting platform they use.

In the end we put the users first because without them the project would just wither away!

Re:Why WordPress theming sucks by Robin_Message on Wednesday September 22, 2010 @12:29PM (#1716664)
Why bother? You could go a long way and make things clearer by giving the functions better, new names and deprecating the old ones. "Rewrite with OOP and MVC" is an easy, whiny, pointless suggestion. Wordpress is warty, but it doesn't need a rewrite.
Re:Why WordPress theming sucks by byoung2 on Wednesday September 22, 2010 @02:47PM (#1717119)
Rewrite with OOP and MVC" is an easy, whiny, pointless suggestion

Separating the design from the code would make it a lot easier for designers to create themes without having to worry about PHP. A proper templating system like Smarty would make a huge improvement with its built-in modifiers. For example:

  <?php 
    $title = the_title( "<h1>", "</h1>", true ); 
    if(strlen($title > 80) {
      echo(substr($title, 0,80)."..."); 
    }
  ?> 
Would be this if Wordpress used Smarty:

  <h1>{{$TITLE|truncate}}</h1>
This makes any display logic in the templates more portable when switching themes as well, because designers will be less prone to putting that code in header.php or single.php.
Re:Why WordPress theming sucks by westi on Thursday September 23, 2010 @08:57AM (#1719432)
We don't use Smarty for a number of reasons.

Anyway PHP is itself designed as a Templating language and works very well.

Adding Smarty or any other templating language into the mix just means that users and developers have to learn both PHP and the templating language.

Re:Why WordPress theming sucks by Robin_Message on Wednesday September 22, 2010 @04:19PM (#1717378)
I agree, but the point is it is not a rewrite to add a templating engine to Wordpress; in fact it would be a (relatively) simple additional theme style that could co-exist with the existing PHP themes.
Re:Why WordPress theming sucks by byoung2 on Wednesday September 22, 2010 @04:56PM (#1717491)
in fact it would be a (relatively) simple additional theme style that could co-exist with the existing PHP themes

In the process of adding a templating system to Wordpress you would come across many instances where you'd wish that instead of having to bother with structures like:

  <?php 
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      ...add posts to an array, then assign to template...
The developers had just used an object model that let you do something like:

  $smarty->assign('POSTS',Post::getRecent(10));
And then access them in the template like this:

  {{foreach from=$POSTS item=post name=posts}}
    <h2>{{$post->title|truncate}}</h2>
    <p>{{$post->content}}</p>
    {{$post->url->permalink}}
  {{/foreach}}
Re:Why WordPress theming sucks by westi on Thursday September 23, 2010 @08:55AM (#1719425)
If your interested in a rewrite of WordPress then I'm sure the Habari guys would be interested in your help.

They started a while back on doing pretty much just that.