- I favorited a YouTube video — Mary Carillo's Badminton Rant – Athens 2004 http://youtu.be/cZDn0U0w78k?a #
Year: 2010
Convert WordPress tag to existing category
By now most people have figured out what is the difference between categories and tags, and which ones to use where. Â But that doesn’t necessarily mean that the problems are over. Â Once in a while there is a need to convert from one to another.
WordPress provides the tool to convert from categories to tags. Â But I needed something for the reverse process. Â In fact, I had a slightly more complicated situation – I already had both a tag and category with exactly the same name, and a whole lot of posts which were tagged, or categorized, or both. Â Messy! Â I was looking for a quick way to add all posts tagged with specific tag to the category with the same name. Â Once that is done, I could easily delete the tag. Â After a few Google searches, nothing straight-forward came up, so I decided to not waste anymore time and wrote my own little script.
Below are the pros and cons of my approach.
Pros:
- Standalone script, not a WordPress plugin. Â It is not utilizing any of the WordPress configuration or functionality, but raw PHP and direct connection to the database. Â You can do a dump of your database, restore it on a totally different machine and play with this script until you are sure you are getting the expected results. Â No worries about screwing up the live database.
- Requires both the tag and the category to be present. Â It will not proceed unless it will find both.
- Safe. Â While there is no undo for the effects of the script, it still works pretty safe. Â Nothing is ever deleted or updated in the database. Â Only the new records are added – for posts to appear under the selected category. Â Nothing else!
Cons:
- Standalone script, not a WordPress plugin. Â It is not utilizing any of the WordPress configuration or functionality. Â You will have to specify your database credentials by editing the script. Â You will also might need to change SQL queries to reflect your WordPress tables prefix.
- Runs from the command line. Â If you don’t have access to or don’t know how to use the command line – tough luck!
- Code quality. Â I wrote this as a very quick and dirty solution to my problem. Â It is not intended to be executed frequently. Â Neither it is not intended to be executed by someone other than myself. Â Yeah, I know, this will probably change, but I don’t care at this stage.
Now, you’ve been warned, so I won’t be holding you off from the source code any longer.
Sabaton – Midway
Sabaton is coming to Cyprus at the end of the month. Â They will be performing in TePee rock bar, Limassol on August 28th. Â I’ve scheduled a reminder post for early that week. Â Here is a video for now.
[youtube=http://www.youtube.com/watch?v=XsjGnBPjYDs]
StarCraft II Launch Trailer
[youtube=http://www.youtube.com/watch?v=rgyL08nhtkw]
As much as I am excited about StarCraft II, chances are I won’t ever play it. Â The game is released only for PC and Mac, and I am a PlayStation 3 man these days. Â But whatever the case, this is a huge event in the gaming world.
Wildfires of Russia
Hundreds of wildfires followed last week all time high high temperature and drought. Â Dry forests and wind is not the best combination for fire safety. Â As a result, more than 40 people dead and more than 1500 houses burned down across the country. Â And with no changes in the weather, it’s probably not the end of it yet.
My grandfather’s house got nearly burned down by the wildfire as well. Â Luckily, in the last moment there was a change in wind direction which turned the fire away. Â Even if nobody died in my home city, fire destroyed more than 500 hectares of the forest. Â That’s 5,000,000 square meters!
Big Picture blog covers the story.