Emacs GNU/Linux Free Software & Open Source Tutorials & Tips

Post to WordPress blogs with Emacs & Org-mode

Recently I’ve discovered Org2blog, an Emacs mode to write your blog posts locally using org-mode post them to your WordPress blog in a very fast and easy way.

I’ve written before on how to write your blog posts and publish them using Emacs. Previously, my method of choice was using Weblogger mode. I even wrote some enhancements to it.

The problem I found with this method is that it uses message-mode as its base mode. So you’re basically writing an email. The shortcomings of it were that whenever I wanted to write links, bold text, or any custom formatting generally done through HTML tags, I had to either type out the HTML or temporarily switch to html-mode. That sometimes gave me some problems converting the HTML code into entities, and ended up with a mess to fix at the WordPress editing textarea.

Org-mode (included in Emacs since about version 22.1), if you haven’t heard about it already, is a very good way to take notes, organize your tasks, among other day to day useful things. You also get some basic formatting like bold text and italics, as well as links among many other useful things. Nowadays, I find myself typing things in org files constantly throughout my day, and with all its long list of qualities, it became a more suitable way for me to write blog posts.

Org2blog provides a way to post your Org files or post a subsection of your file with a few keystrokes. All you need to do is clone the repository on your load path directory

git clone

Then, add this to your .emacs file

  (setq load-path (cons "~/.emacs.d/org2blog/" load-path))
  (require 'org2blog-autoloads)

Finally set up you blog(s) settings in you .emacs file

     (setq org2blog/wp-blog-alist
              :url ""
              :username "username"   
              :default-title "Hello World"
              :default-categories ("org2blog" "emacs")
              :tags-as-categories nil)
              :url ""
              :username "admin")))

To start wrigint a new post, you can now use
M-x org2blog/wp-new-entry

Or, as I more frequently use, post a subtree of an existing org file using:
M-x org2blog/wp-post-subtree

I hope you enjoy writing and posting your blog posts within Emacs and Org-mode. I certainly do and has turned out to be a very fast way to quickly draft and later on (even offline) elaborate on the blog post details in a comfortable editing environment. Also you get the added benefit of having a local copy (backup) of your blog posts as Org files.

Emacs GNU/Linux Free Software & Open Source

Emacs weblogger mode with WordPress tags support

wordpress tags with weblogger.el mode
I’ve been looking for ways to blog from Emacs and so far my best solution has been to use weblogger.el. This mode supports many blogging platforms through the xmlrpc apis for blogger, metaweblog, livejournal and movable type. For more details about this mode, visit the emacswiki page.

Since this blog is based on WordPress and it supports the metaweblog api, this has worked very well. My only complaint was that since WordPress version 2.6, tag support was added and blogging from Emacs left my posts without tags. So I decided to add the tags support using the mt_keywords method on the metaweblog api, which on WordPress maps to the post tags. All you have to do is add the Summary label on the post header and write down the tags separated by commas.

You can download the patched weblogger.el here. Its based on the latest patched version on the emacswiki page by Tom Robinson which added handling of the <!–more–> tag and added Keywords in the header by default.

Now the only thing I’m missing is uploading images and files with the post.


Actualizando a WordPress 2.3

Wordpress 2.3
Hoy he actualizado este blog a la nueva version de WordPress 2.3 que salio hace algunos dias.

La actualizacion fue muy sencilla, solo descomprimi el archivo .tar.gz (en mi caso), reemplace todos los archivos viejos por los nuevos, despues entre a la pagina de upgrade, y listo! No tuve que modificar nada mas, y por lo que veo hasta ahorita, no tengo ningun problema.

Veo que ahora hay un sistema de tags nativo en WordPress…ahora que voy a hacer con mi ultimate tag warrior plugin? Ya vere mas adelante que otras mejoras trae esta nueva version.

Por lo pronto, estoy contento con que nada se haya roto en el proceso de actualizacion….

Hmm…justo cuando estaba por terminar este post, me aparecio arriba de mis botones de Publish y Save un mensaje de error:

WordPress database error: [Table 'nopublicaremidatabasename.wp_post2cat' doesn't exist]
SELECT cat_ID AS ID, MAX(post_modified) AS last_mod FROM `wp_posts` p LEFT JOIN `wp_post2cat` pc ON p.ID = pc.post_id LEFT JOIN `wp_categories` c ON pc.category_id = c.cat_ID WHERE post_status = 'publish' GROUP BY cat_ID

—— Correcciones ——-

Pues resulta que ya no tengo que preocuparme del Ultimate Tag Warrior plugin, porque es incompatible con WordPress 2.3, al menos en la version 3.1415…(pi?) y por eso me daba ese error. Tambien si tienen en Google sitemap plugin hay queactualizarlo a la version >= 3.

Con esos cambios se acabaron mis problemas mencionados arriba.
Mas informacion acerca de esto lo pueden encontrar en:
Ah, otra cosa que note es que en la seccion de plugins ahora te notifica si hay una nueva version de tus plugins para que los actualices. Que buena idea.