The latest version of WordPress (or at least this got changed in one of the newer versions) leaves the Edit Post screen open after publishing post. It should really open a blank Add New post page, or simply return you to the Dashboard. I just don’t understand why I would want to edit the post I just published.
Posts Tagged: WordPress
Installed Subscribe to Comments Plugin
I installed the Subscribe to Comments plugin by Mark Jaquith, a plugin that WordPress.com chose to enable on the millions of blogs hosted there (congrats Mark!). I’ve always liked being able to subscribe to follow-up comments on posts that I comment on, so perhaps my visitors will appreciate having the same option on this blog.
Updated the Modified Grid Focus Theme
It took a bit of work to add support for comment threading (new in WordPress 2.7) to this theme’s template, but if you happen to be using my modified version of the Grid Focus theme, you can download the theme again to get the updated version. In hindsight, I should have checked first to see if the original author had updated the theme before spending time on it myself.
Blogging from the Command-Line
I’m a command-line person. If you can show me a command-line version of something I already do in a windowed environment, I’ll get stuff done faster. I often look for command-line solutions to tasks that become repetitive and feel as though time could be saved by doing them on the console.
A recent example of this is the posting of asides on my blog. Asides are often very short (one or two sentences at most — they appear on my blog without a title) and navigating the WordPress Administration interface in a web browser simply to post one or two sentences became very time consuming and distracting. Since I’m constantly editing files and code on the console using my favorite editor (vi), being able to quickly create and post an aside from the same environment would be awesome.
Before writing a tool that allowed me to post to my WordPress blog, I searched Google to see if someone else had already written something. Sure enough, I found blogpost, a script written in Python by Stuart Rackham:
blogpost is a WordPress command-line weblog client. It creates and updates weblog entries directly from AsciiDoc (or HTML) source documents. You can also delete and list weblog entries from the command-line.
It uses XML-RPC to post to WordPress blogs and also supports automatically uploading media files (images, videos, audio, documents) that are referenced within the AsciiDoc (or HTML) post file. Check the blogpost man page for full details.
Remember, my main goal here is to make posting short asides easier. I’m perfectly happy using the WordPress web interface to write longer posts. In fact, I prefer the web interface for longer posts because I get things like automatic spell checking (through OS X) and automatic draft saving (through WordPress).
After installing blogpost and modifying the configuration file to include my WordPress login details, I created a file called post.txt using the vi editor and, after saving the file and closing vi, I published the aside using blogpost:
$ blogpost.py --title="My Test Aside Post" -U --doctype='html' create post.txt
creating published post 'My Test Aside Post'...
id: 2758
url: http://blog.raamdev.com/2009/01/24/my-test-aside-post
$ blogpost.py cat --categories="Asides, Blog Entries, General" post.txt
assigning categories: Asides,Blog Entries,General
Note that I only need really basic formatting (i.e., HTML for links), so I use the --doctype='html' option. This allows me to type raw HTML in vi when I’m editing the post file, just as I do now in WordPress (I don’t use the Visual Editor).
While the options and flexibility provided by blogpost are great, the process of publishing an aside needed to be more automated to solve my problem. Creating a new file in vi, typing all those options, running two separate commands, and then deleting the file every time I wanted to post a few sentences on my blog didn’t make a whole lot of sense. So I whipped together this little shell script to help automate the steps above:
#!/bin/sh ## ## aside.sh - automates publishing asides using blogpost.py ## # Open a temporary file in the vi editor vi aside.$$ # Display new aside before publishing echo "New Aside:" cat aside.$$ echo # Prompt for an aside title echo "Enter a title for this Aside:" read TITLE echo "OK!" echo # Using the temp file saved above, post the Aside blogpost.py --title="$TITLE" -U --doctype='html' create aside.$$ blogpost.py cat --categories="Blog Entries, Asides" aside.$$ # Remove the temporary file rm aside.$$
Now posting an aside to my blog is as simple as running ./aside.sh, typing the aside in vi, saving and quitting (:wq), and then typing a title. The rest of the work, including cleanup, is taken care of by the script!
Stuart did an excellent job with blogpost and if you have a blog and use the console (and why shouldn’t you?!) I recommend you check it out. The blogpost README is a great place to start, as it includes prerequisites and installation information.
WordPress 2.7: Fixing ‘Fatal error’ with Automatic Upgrade
A few days ago I installed WordPress 2.7 RC1 on one of my blogs to get a feel for the new interface. One of the awesome new features of WP 2.7 is the built-in upgrade feature, a feature that the very cool WordPress Automatic Upgrade plugin has handled for me up until now.
I was eager to try the new built-in upgrade feature, so when WP 2.7 was officially released I rushed to upgrade the RC1 blog (Tools -> Upgrade). To my surprise however, I was shown something that did not even remotely look like a success message:
Fatal error: Cannot redeclare class pclzip in /home/homeproj/public_html/wp-admin/includes/class-pclzip.php on line 171
After a little research, I discovered the problem was the WordPress Automatic Upgrade plugin! Both the WPAU plugin and the built-in upgrade functionality of WordPress 2.7 must declare the same pclzip class. This means you cannot have the WPAU plugin active and use the built-in upgrade functionality of WP 2.7 at the same time.
To fix the problem, you simply need to deactivate the WordPress Automatic Upgrade plugin.
If you don’t have the WPAU plugin installed, you can try deactivating all of your plugins to see if any of them are causing a conflict.
