org2blog/wp should, ideally, work with any platform that supports xml-rpc but some of wordpress specific features may not work.
org2blog is licensed under GPLv3
Download org2blog from GitHub or Marmalade
git clone http://github.com/punchagan/org2blog.git
Add the org2blog directory to your load path and then add
(setq load-path (cons "~/.emacs.d/org2blog/" load-path)) (require 'org2blog-autoloads)
to your dot emacs.
- org2blog depends on
Add them to your load-path before using org2blog.
- Make sure you have the latest org-mode installed. It may work with versions > 7, but it is best to have the latest org-mode if you can.
Defining your blog setup
Note - This setup works only for org2blog version >=0.3. For lower versions of org2blog check the README from the commit e37126e
You can (should) tell org2blog where your blogs are and optionally
specify different values for some options. This is done by
customising the variable
(setq org2blog/wp-blog-alist '(("wordpress" :url "http://username.wordpress.com/xmlrpc.php" :username "username" :default-title "Hello World" :default-categories ("org2blog" "emacs") :tags-as-categories nil) ("my-blog" :url "http://username.server.com/xmlrpc.php" :username "admin")))
This defines two blogs identified by the terms
The variables in the
plist set for each blog over-ride the
global values of the corresponding variables.
are mandatory variables. Others are optional. If you customize the
org2blog/wp-blog-alist there is detail information about the
meaning of each property.
You can also use
.authinfo files to save your usernames and
.netrc should look like this
machine myblog login myusername password myrealpassword
Then, use these details, as shown below.
(require 'auth-source) ;; or nothing if already in the load-path (let (credentials) ;; only required if your auth file is not already in the list of auth-sources (add-to-list 'auth-sources "~/.netrc") (setq credentials (auth-source-user-and-password "myblog")) (setq org2blog/wp-blog-alist `(("my-blog" :url "http://username.server.com/xmlrpc.php" :username ,(car credentials) :password ,(cadr credentials)))))
To browse or customize other variables use the customize group function.
M-x customize-group org2blog/wp RET
Use M-x org2blog/wp-login. This function ask you for the name of one of the blogs you have configured in the org2blog/wp-blog-alist variable described above and will ask for your password. The counterpart of this function is M-x org2blog/wp-logout, which will log you out of the active blog.
Writing a new post
Use M-x org2blog/wp-new-entry.
- Tags and Categories are comma or space separated values. Completion (for both) is triggered using C-c t. If a new category is used you will be prompted before adding it.
- The excerpt for a post can be written as
- The Permalink of a post can be set using
- The parent for a page can be specified using
#+PARENT. C-c t again provides completion for the page name.
Using post templates
Custom post templates can be specified by modifying variables
(setq org2blog/wp-buffer-template "----------------------- #+TITLE: %s #+DATE: %s -----------------------\n") (defun my-format-function (format-string) (format format-string org2blog/wp-default-title (format-time-string "%d-%m-%Y" (current-time))))) (setq org2blog/wp-buffer-format-function 'my-format-function)
org2blog/wp-new-entry will now create buffers begining with a default
title and the current date.
Updating an existing post
To update a blog post, you can simply edit the content of the org
file and republish using
POSTID saved in the
file, ensures that the same blog post is updated, and a new post
is not made.
|post buffer as draft||C-c d||M-x org2blog/wp-post-buffer|
|publish buffer||C-c p||C-u M-x org2blog/wp-post-buffer|
|post buffer as page draft||C-c D||M-x org2blog/wp-post-buffer-as-page|
|publish buffer as page||C-c P||C-u M-x org2blog/wp-post-buffer-as-page|
Post your existing org-files too
#+DATE, to your file. (All of these are Optional)
- Add a
#+POSTIDto edit an existing post.
- Post buffer using the function names, as above.
Posting a subtree
- Use M-x org2blog/wp-post-subtree.
- Tags of the subtree will be used for tags.
- Other properties can be set using a property drawer. The properties use the same names as the buffer variables.
POST_DATEsets the date to be used for the post. If it is not present,
DEADLINEor any other active or inactive time-stamps are used.
- The headline is used as the title of the post. But,
TITLEcan be used to use a different title.
Posting source code blocks
Babel source blocks or example code is automatically posted in
<pre> tags. You can ask
org2blog to use Wordpress’s
sourcecode shortcode blocks. To use this, you need to set the
org2blog/wp-use-sourcecode-shortcode and also add
htmlize.el (available in org-mode’s
contrib/lisp) to your
load-path. Wordpress’s sourcecode shortcode blocks can be given
various configuration parameters. These can be passed to the
exported sourcecode shortcode blocks via an
immediately preceding the
#+BEGIN_SRC line, e.g.
#+ATTR_WP: :syntaxhl light=true
You could also modify the default arguments passed to sourcecode
shortcode blocks by customizing the
Delete an entry or a page
- If you are in the buffer of the entry/page, with
#+POSTIDpresent on the page, use:
M-x org2blog/wp-delete-entry or M-x org2blog/wp-delete-page
- If you want to delete a particular post (whose post-id is known)
from any buffer, use
C-u post-id M-x org2blog/wp-delete-entry.
Similarly, for a page.
Enabling org2blog mode (defines key-bindings)
- use M-x org2blog/wp-mode.
This defines the following the key-bindings:
C-c p publish buffer C-c d post as draft C-c t complete tag or parent page name
Uploading Images or Files
In-line images and linked images (or files) with file:// urls will be uploaded to the media library and the links will be updated. Information about uploaded files is added as a comment to the post itself.
Captions and attributes as defined in org-mode will be preserved, but these attributes are not saved with the image to the library itself.
“Dashboard” of all posts
org2blog makes it easy to manage your blog-posts by actually
keeping track of all the posts you make from it, in a simple
org-table. By default it is saved in a file
org-directory. This is meant to be a dashboard of sorts,
and is an optional feature that can be turned off.
- You may want to look at the Export options and HTML export sections of the org-manual.
- If you wish to post to blogger from org-mode, look at -
- Please go through the README and the FAQ, before writing to me.
Also, looking at
M-x customize-group org2blog-wpmight help.
- If you have an issue/bug/feature request, use the issue tracker
on git or drop a mail to punchagan+org2blog[at]gmail[dot]com.
I’d also appreciate patches/suggestions to improve the
documentation. Feel free to drop in with general comments, too.
I’d love to hear from you! NOTE: If you are using the package
from ELPA/Marmalade, please try using the latest
gitversion before filing a bug report.
- Feel free to add your site to the list of sites using org2blog, on the wiki at github.
- How many blogs can I configure with org2blog?
You can configure and use any number of blogs with org2blog/wp. Use the
org2blog/wp-blog-alistvariable to configure each blog. Look at the Defining your blog setup section, in the README. But, note that you can be logged in, to just one blog at a time.
- How do I change the default title of a new post?
(setq org2blog/wp-default-title "My New Title")
- How do I change the default title for one blog alone?
Set the relevant (
:default-title) variable in the
- I do not use tags. I wish to use them as categories. How?
org2blog/wp-use-tags-as-categoriesvariable will do that for all the blogs.
(setq org2blog/wp-use-tags-as-categories t)
Instead, you can set the corresponding variable for each blog that you are using.
- Can I configure org2blog to confirm before publishing a post?
(setq org2blog/wp-confirm-post t)
- I wish to customize the default template of a new post. How do I
Customize the variable
- New-lines are not handled properly. Why?
The behaviour of new-lines has been working since a little before version 0.3. It is highly recommended that you use the latest git version of org2blog.
By default, new lines are stripped off from the org buffer. To retain new-lines, unset the
- Why aren’t my SRC blocks not enclosed in
org2blog/wp-use-sourcecode-shortcodevariable to turn on this behaviour. You may also set it at a per-blog level, if you choose.
- Is wordpress the only CMS/Blog-engine that org2blog/wp supports?
Any blog engine using the metaweblog API should work, theoretically. But, it is not tested with other blog engines.
- Is there a way to import from wordpress or other blogs into the
org2blog post format?
I’ve a simple python script that uses
pandocto convert from Wordpress export xml to org2blog posts. It could easily be tweaked to write importers for other kinds of blogs.
- How do I split a post into an introductory paragraph and a full
Just put in
at the location where you wish to split the post.