Alfa Jango Blog Engineering, Software, and Entrepreneurship

Archive for the ‘Wordpress’ Category

Pure-CSS Emoticons WordPress Plugin Released

Wednesday, September 22nd, 2010

I’ll keep this post short and sweet. My good friend, Anthony Montalbano, has released a WordPress plugin for our CSSEmoticons jQuery plugin. Now you can use pure-CSS emoticons in your blog or WordPress site simply by installing and activating the WordPress plugin.

The WP plugin currently has options for you to apply “emoticonization” to your posts, the comments, or both.

Also, since the CSSEmoticons jQuery plugin doesn’t currently work with Internet Explorer, the WP plugin automatically reverts to WordPress’s built-in emoticon image-replacement for Internet Explorer.

Be sure to check it out and try it on your blog if you’re cool enough B-) . We’re already using it on this one, and we <3 our new plugin.

How to Include Your Rails App Layout in Your WordPress Theme (or any PHP application)

Tuesday, February 23rd, 2010

Here’s the problem: You have a Ruby on Rails application and its WordPress blog. For the sake of consistency and branding, you’d like to use the same layout in your WordPress blog as you do for your Rails app. Perhaps your blog is one of the main links or tabs in your application’s header.

Why this doesn’t work: You proceed with creating a custom theme for your WordPress blog that looks exactly like your Rails application. Then over the next couple years, you begin to realize how tedious this solution is. You have to copy over your CSS stylesheets from your Rails app, your Javascript files (if your standard layout contains any Javascript elements, like a Twitter widget in the footer or whatever), and your layout images and assets. Then, every time you change or update the layout of your Rails app, you have to copy the changes in your custom WordPress theme. And you cannot just copy the changes, because if you have any Ruby/Rails functionality in the layout, you have to translate them into PHP functionality in your WordPress layouts.

And then there’s the impossible stuff… if anything in your Rails app layout loads information from the database in your Rails app, then you cannot have those elements in your WordPress layout, unless you do something like create an XML or JSON feed in your Rails app and then import it in your WordPress layout. But this is quite tedious still if you want to change any of it!

There’s an easier way.

Include Your Rails Layout Directly In Your WordPress Layout

The solution I found turns out to be quite simple. The basic idea is to create a :partial in your Rails app layout, make it publicly accessible via your config/routes.rb, have it generate and simply return the appropriate html using your controller method, and then import that html (and CSS) in your WordPress layout.

(more…)