Bad experiences in #wordpress on Freenode

Common conversation on #wordpress on Freenode:

$new_visitor:
Hello friends, anyone experienced with Elegant Themes Divi theme? I have created a blank page that has no header or footer, I have added a background image to fill the screen and a few other things, my issue is that the theme is not automatically filling in the screen with the layout. Its either too short or too long depending on browsers and screens. Anyone have a solution for this?

$channel_regular:
$new_visitor: sure, learn css
and/or use the theme how it was intended

$new_visitor:
I appreciate the kind words $channel_regular

$channel_regular:
i didnt say anything unkind
its definitely not a wp issue

Obviously it’s not the only kind of common conversation on #wordpress, but there’s really no need for that.

Too bad the community does not enable a better atmosphere on the channel, cause it doesn’t seem like something that would be too hard to do.

Setting up a WordPress install for “theme unit tests”

Documentation for Theme Unit Tests is at http://codex.wordpress.org/Theme_Unit_Test

Did it all through the Mac terminal…

Pre-requisites: Homebrew, homebrew’s mysql package ( brew install mysql ), and homebrew’s php55 package. Ask if you have trouble installing them.

Installing wp-cli

Documentation for wp-cli is at http://wp-cli.org/

curl -kL https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info

Creating a WordPress install

mkdir wp-trt
cd wp-trt/
wp core download
wp core config --dbname=wp-trt --dbuser=root
wp db create
wp core install --url=http://localhost:6789 --title=WPTRT --admin_user=danny --admin_password=blastworth --admin_email=dan@bernardic.ca
nohup php -S localhost:6789 &
* I was getting an error recently with a fresh install of mysql from homebrew, saying a database connection can not be established, during the `wp core install` step. After creating the symlinks as shown here, it worked.

Installing theme unit tests

curl -O https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml
wp plugin install wordpress-importer --activate
wp import ./theme-unit-test-data.xml --authors=create
rm theme-unit-test-data.xml

I took part in developing WordPress 3.8 ( Not really! )

WordPress 3.8 is out. Dan Bernardic ( me ) is listed as one of┬áthe “188 contributors with props in this release” of WordPress. While that is flattering, I think it is misleading, so I feel the need to publicly make that clear. There almost certainly isn’t a single line of code in WordPress 3.8 that I’ve written. Perhaps next time!

The reason I am listed there is that I tried to contribute to development of a plugin that was revamping one of the WP admin screens called the “Dashboard”. I did not end up contributing anything useful that I am aware of, partly due to lack of time, but perhaps more so because it was not fun enough for me. I tend to find time for things that I find to be fun.

Rails vs. WordPress

I’ve been thinking about the topic of when I should use an MVC | framework, and when I should use a CMS platform ever since I discovered Drupal about 2.5 years ago. I don’t believe the topic is covered really well on the Web, and most people seem to have a shallow understanding of the topic, so I’ll share my thoughts with you.

The popular question in my company these days is “Rails or WordPress?”, but I will probably touch upon the broader questions of “MVC or CMS?” and “Ruby or PHP?”, so you can often substitute “Rails” for “MVC framework” in the article.

Something to also keep in mind is that in my experience the other MVC frameworks are much closer to being real competitors to rails than any other CMS is to WordPress, so that is something also to keep in mind (let us know in the comments if you want to propose some CMS candidates for using on projects instead of WordPress).

The Cop-out

The most common answer I hear from people, who I assume haven’t really thought about this for long, is “Rails is for web apps, WordPress is for websites.” But is my web-based system a website or a web app? Can most web-based system be put into one or the other category, or the other? Do you think you could score 5 out of 5 on a quiz which would show you a web-based system and ask you to pick a) website or b) web app?

The Gimmes

I’ve identified some traits of web-based systems which make it easy to choose one or the other.

I should say that regardless of the requirements of the system you’re building, in my opinion you should strongly consider whether the programmers you have available are much more proficient in one of the two environments. If your programmers are experts with Ruby and Rails and haven’t written even a 1000 lines of PHP, it is almost certainly better to use Rails for any system (except if you need a blog or promotional corporate website without any custom software development). Same for a team that is made up of WordPress and PHP experts with little Ruby and Rails experience.

Rails Gimmes

If you’re building a transaction processing system in which data and various views of that data are the only functionality, Rails is the natural choice. Examples that come to mind are a POS system, or a system that stores data about the amount of calls your call center is receiving, and then creating robust reporting based on that.

When looking for a Plastic extrusion company producing Angles, Flat sections, Channels & more. Visit this website lakelandplastics.com for more information.

If the web-based system you are creating does not have an element of web publishing, and your customer does not have a need for most of the screens in the WordPress admin, you should pick Rails.

If your web-based system is a web service built on top of an existing legacy database and doesn’t have a website component, you should pick Rails.

Please contribute good descriptions of projects where you’d pick Rails in the comments, and I will include them here along with a reference to a URL of your choice.

WordPress Gimmes

If you’re building a blog, you should use WordPress.

If your project will need all or most screens of the WordPress admin, you should use WordPress.

If you’re making a web publication system (CMS-based system) you should use Drupal. No, just kidding, use WordPress, since Drupal kinda sucks unfortunately. Sorry Drupal, you were an OK attempt, but WordPress is probably a better choice for any web-based system.

Please contribute good descriptions of projects where you’d pick WordPress in the comments, and I will include them here along with a reference to a URL of your choice.

The Pattern

If your team is about as proficient with both WordPress and Rails, or you’re shopping around to hire a team and both solid Rails and WordPress teams are available, it comes down to opportunities for code reuse. Will your system re-use more code if you use WordPress and its very usable admin area, myriad of available plugins and themes? Or can you re-use more code by harnessing the object-oriented design, DSLs and good software development practices mecca that is Ruby, Rails and the available libraries and tools?

In terms of the decision of Rails vs. other CMSs available, technically Rails is probably the leader of the pack for a large majority of applications. The advantage of Rails disappears if your programmers are much more proficient with Python or PHP, since there are probably good enough alternatives in their language, namely Django and CakePHP, but code re-use opportunities each MVC framework will bring should again be taken into consideration.

Writer’s Bias (Why I think I am well-positioned to write this article)

You can read about my professional travels so far.

I now work for a company that uses both Rails and WordPress, and I am actually hired and paid to help make these exact kinds of decisions. I hope you will provide valuable feedback and discussion to help reach a further deeper understanding of the topic.

The Ian Daniel Stewart Experience

The twelfth monthly Winnipeg WordPress meetup was yesterday. The first one was in November 2010, and I started coming at the second one, at which I got the WordPress t-shirt that people often see me in since then.

I always look forward to seeing the kind, intelligent and geeky people who attend them, and none more than Ian Stewart, the meetup’s modest and inspiring organizer.

Yesterday’s meetup featured an entertaining, inspiring and informative presentation by Ian, in which the word “Love” was prominently featured, along with Christmas-related pictures and a story about Ian’s personal journey through WordPress theme development. I think that every Winnipegger who is a web designer working with WordPress should use the opportunity to speak with him and learn from his experience.

Thanks Ian for a great year of meetups, and I look forward to another one!

Pushing Out Blog Content to Social Media Outlets

Instead of posting content directly on Facebook or Twitter, post content on your blog, then push it out to the social media outlets.

Ian Stewart and David Pensato, two fellow Winnipeg WordPress fans commonly talk about the importance of owning the content you post to the web, and how posting content to Twitter or Facebook is not the best for ensuring you will always have access to that content in the future.

After a WordPress Portfolio Tutorial Matt Wiebe presented at New Media Manitoba, at which he’d mentioned the Social plugin, I’d installed it and decided I’m going to blog more often instead of just tweeting, then push out a tweet and Facebook post using the plugin.

The Social plugin has gone through some issues recently, and I was not able to push out content to Facebook for a while now. Also Automattic has recently released JetPack 1.2, which seems to have features that are similar to what the Social plugin provides (pulling comments on your blog post from Facebook and Twitter), although I am not sure that’s the case.

Now there is a 2.0 version release of the Social plugin, so if anyone has the scoop on the state of the two different plugins and where each is stronger/weaker, I’d be glad to hear it. Otherwise, just install one, the other, or both, and enjoy the features they add to your blogging experience!

WordPress and NetBeans

Here’s a few tips for how to make the most out of NetBeans for developing WordPress websites.

Making NetBeans aware of WordPress functions so it can suggest autocompletion

Working with WordPress, I often have to look up how to use a function I’ve used before, but have forgotten the order of parameters. The codex, and in particular the WordPress function reference and WordPress template tags reference pages are great places to look for such things. However, if you set up NetBeans to be aware of the WordPress functions, sometimes you can save yourself a trip to the codex. NetBeans is by default aware of any functions defined within any files in your PHP include path, as well as any functions you have defined in your project. One way to make NetBeans aware of the WordPress functions would be to have WordPress core within your project, but I would prefer to not have it there. When working on files on remote servers, main reason I would use NetBeans over vim, it is a little bit cumbersome to download all of WordPress core, and I usually only download what I need from wp-content. In such a scenario, you can teach NetBeans to also load a local copy of WordPress into memory. To teach it that, go to Tools -> Options, then PHP tab.

Code completion will then be enabled, and the PHPDocs in WordPress will be parsed shown when looking at the available functions. In the picture below, I typed ‘WP_Q’ and the autocomplete functions became available below it, as well as the documentation dialog above it.

WordPress Coding Style Adherence

The WordPress coding standard defines how your code should look so that it looks the same as the code in WordPress core. Adhering to a coding standard is a good idea because it promotes consistency and makes for easier reading of the code you write. I’ve prepared an export of the Netbeans configuration for the editor to adhere to the WordPress coding standard. I hope you find it useful! To import it, Click Tools -> Options in the top menu, then press the “Import” button in the dialog window that comes up and follow the instructions there.

What’s Next?

A nice feature that is not available to the extent of my knowledge would be templates for common WordPress files, like there are template for Java classes, and such. The way this would work is you could say “I’m going to make a new theme” and it would create all the files a theme requires. Or “I’d like to make a widget.”, “I’d like to write a shortcode.” and NetBeans would create the “boilerplate” code so you can get to coding right away.

Do you have any NetBeans tips you’d like to share with your fellow WordPress site builders? Do you know of a plugin for NetBeans that adds those templates I mention in the section above? Thanks for reading.