Posts Tagged ‘wordpress’

WordPress: Auto Tag while you sleep! WPCalais meets the cron job

Wednesday, July 23rd, 2008

So working on allbiodiesel.net I came across a great plugin by Dan Grossman, WP Calais Archive Tagger, which is really only the step brother of the WP Calais Auto Tagger, which due to its granular application is less interesting to me.  Basically this plugin parses your blog posts, analyzes your text, and spits bag tags that it thinks are descriptive of the blogpost.

Hm, no big deal you might say, and I would agree if you’re talking about a little blog (like this one for example), where you don’t write that many posts.  However, once you start thinking about feed aggregation, this becomes a fascinating -  and extremely useful - tool.  With hundreds of posts coming in every day (I use FeedWordPress), there’s no way I’m going to tag all of them.  Being able to automatically parse and tag posts become invaluable then.

The problem: WP Calais Auto Tagger lets you auto generate tag as you’re writing the post.  However, with feed aggregation, you’re not actually writing the post, they are generated automatically.  So this is useless. Ok, WP Calais Archive Tagger is getting close to the problem: it lets me autotag my entire archive of posts.  Ok, so I tag 300 posts, and the next day 50 are added… well, it tags all 350 now.  Plus I’d have to go in and manually hit the button.  Do I want to do this every day? No.  So, what I am was looking for was something that would do this automatically for me.

I’ll be the first to admit, my PHP programming skills are horrible, totally not 733+.  However, I can look at some code and figure out what’s going on.  A few echo statements sprinkled throughout and I catch on; change a variable here or there and see what it does, ok, I get it.  So I took the WP Calais Archive Tagger code, stripped it down so that it could be run through a cron job (meaning it had to instantiate the WP environment itself), and voila, I’ve got posts coming in automatically and then soon thereafter being tagged… automatically. While I’m sleeping.  My tag cloud is building itself.  Knowledge, patterns, trends emerging while I sit back and relix.

Pretty cool.

Anyway, long story short, here’s the file I hacked up.  Enjoy!

http://www.leeclemmer.com/calais-cron-tagger.rar

Update (8/20/2008): Please be aware that you need to have the Calais Archive Tagger installed first for this to work ;)

Excluding categories from WordPress

Tuesday, January 8th, 2008

Pretty simple. Figure out the category ID of the category you want to exclude: Manage > Categories. To see your feeds without the category in question, use either of the following two formats, depending on how you have your URLs set up:

  • http://www.yourdomain.com/feed?cat=-8 (insert category ID here
  • http://www.yourdomain.com/index.php?feed=rss2&cat=-8

This is what my FeedBurner setup looks like:

My FeedBurner setup.

If you want to exclude multiple categories, just add more “&cat=”’s at the end.

Simple.

Pretty Permalinks: this works for me

Sunday, November 18th, 2007

For some time now, I wanted to be able to use pretty permalinks, that is, render URLs with the category name and post slug without using “index.php”. I’m still fairly unfamiliar with Apache and configuring my host server, but managed to find the solution in the WordPress forum: “Pretty Permalinks issue with 2.3″.

Unfortunately this didn’t seem to work for the guy who posted it, but when I added the following code to my .htaccess, pretty permalinks were suddenly working A-OK (using WordPress 2.3.1):

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Honestly not really sure what’s going on here, but if you’re having issues getting pretty permalinks to work, try this solution out.

Backing up your WordPress database

Saturday, November 17th, 2007

You can find the full instructions to back up your WordPress database over at Wordpress.org, but here are the settings needed for a phpMyAdmin export (more for my own reference than anything else):

  1. Select ONLY those that hold your Wordpress site.
  2. Check the “Add DROP TABLE” box.
  3. Check the “Complete inserts” box.
  4. Check the “Save as File” box
  5. Check the “None” for compression. If your database is very large use a compression method.
  6. Click Go. The data will now be saved into your computer.

WordPress and del.icio.us: Making it work (and how to get rid of the 406 Error)

Friday, November 16th, 2007

So recently I’ve really come to appreciate del.icio.us; clearly I’m late to the game. I had started using Google bookmarks and thought to myself, why not socialize ‘em!? So I installed the Firefox plugin and have been cruising ever since.

One of the things that I wanted to do is post my bookmarks automatically; that way, I can stop posting short blurbs about this or that link. Fortunately, this is possible. Here are the simple steps to start automatically posting your del.icio.us links to your blog:

  1. Set up a del.icio.us account (!)
  2. Go to settings
  3. On the right hand side under Blogging, click daily blog posting (note that this is an experimental feature)
  4. add a new thingy
  5. Fill out the relevant information. If you’re using WordPress, provide the full URL to the file called xmlrpc.php
  6. Blog ID = 1 worked for me, as I only have one blog
  7. The time is whatever time you want your bookmarks to post in military time + 5 if you’re on the East cost (i.e. If you want it to post at 1PM enter 18).

So I did this, and waited for the posting hour to occur, and no post! I went back to del.icio.us and saw that the the thingy had gotten a 406 error when it tried posting. After some google-fu I discovered that my hosting provider is running Apache with the mod_security enabled. Further fu showed me that this problem is easily solved by adding the following line to the end of your .htaccess file in the root of your blogging folder (for me that was public_html):

SecFilterEngine Off

That did the trick! However, this also turns mod_security off altogether! I’m not quite sure what the implications of this might be or how to rectify that situation. The next step is to wade through my server logs and figure out what exactly is triggering mod_security to give the 406 error… which means I have to deactivate del.icio.us posting for a bit, but I’ve already fallen in love with it.

Some things I would definitely like to see in the future is greater flexibility on how your links post is actually displayed. As far as I can tell, you don’t have a choice. Perhaps some PHP parsing + regular expressions could do the trick. Hmm…