If you want to opt out of the licensing game altogether, UNLICENSE is probably the best option. Provide the UNLICENSE.TXT file with your creation and presto: you are in the Public Domain. ...
Monday, December 1, 2014
Tuesday, November 25, 2014
How not to program
Today, I tried to write some simple code to use #-tags in the wordpress backend. It should recognize the #tags, remove the #, add the tags to the post if they’re not present yet and, if they don’t yet exists, create those terms. I had to dig through a lot of wordpress API documentation, Stack Overflow answers, the PHP manual for preg_replace and preg_match_all, and some simple functions I always forget the name of like strtolower or substr (I am blessed with a weak memory). First, the code: function ccb_quicktagsfilter( $content ) { global $tag_ids; $pattern = '/#(\w+)/i'; $replacement = '${1}'; preg_match_all($pattern, $content, $matches); foreach ($matches[1] as $term) { if (!($tid = term_exists( $term, ‘post_tag’ ))) { $t = wp_insert_term( $term, ‘post_tag’, array(‘name’=>$term)...
Monday, November 24, 2014
Visualizer

I found a useful WordPress plugin called Visualizer. It renders charts (pie, bar, world map, etc). I created a map of where I have spent my time [visualizer id=”149″] ...
Bypassing censorship for Wordpress
I came across this cool site: http://www.daobydesign.com/free-plugins/censortive/. Haven’t tried it out myself yet, but this can be very useful for anyone making critical postings and wants to reach internet users in China (or any other country plagued by a repressive regime). ...
Saturday, November 22, 2014
Flickr Fallback Thumbnails

In my last post I wrote something about a small plugin for Flickr thumbnails. Well, here it is. It’s a quick-and-dirty version that assumes everything is working (no conditionals) but well, on this site it does as you can see The class is something like this: 'names' ) ); if (count($tags)==0) return false; $r = rand(0, count($tags)-1); return $tags[$r]; } function get_flickr_img ($tag, $count=1) { $tag = urlencode($tag); $thumb_url = “”; $url = ‘https://api.flickr.com/services/rest/?'; $url .= ‘method=flickr.photos.search&api_key=’.$this->api_key.’&tags=’.$tag.’&per_page=’.$count; $url .= ‘format=’.$format; if...
Wordpress doesn't recognize plugins that have spaces in the header declaration
This one took me a while to find out – I hope this post saves you some time. I was working on a simple Flickr API plugin for WordPress (will post and use it here), but all of a sudden my plugin stopped from showing up in my (multisite) admin back-end. So I headed over to Google and looked if anyone had the same issue. There were a lot of comments about looking at multisite admin rather than the individual network site, some remarks about the contents of the header file – but none about its very syntax. A few extra spaces. Come on, WordPress, why do you use such a strict parser to look at the plugin directory? Why not adding that extra \s* to that regexp you use to identify plugins? ...
Thursday, November 20, 2014
Using dashicons in Wordpress
I was working on a theme today, and wanted to use the neat retina-ready icons we see on the WordPress back-end since version 3.8 or thereabout. This is easy – just load the font “dashicons” in your styles-queue (thanks @Jameskoster): add_action( 'wp_enqueue_scripts', 'themename_scripts' ); function themename_scripts() { wp_enqueue_style( 'themename-style', get_stylesheet_uri(), array( 'dashicons' ), '1.0' ); } …and use the icons by setting the content of the :before pseudoclass to the code. Example: .comment-link:before { font-family: "dashicons"; content: "\f101"; } An overview of all available icons can be found here. ...
Friday, November 14, 2014
Yandex translation API
Google Translate API does a great job, but it is a paid service. For those who don’t want to spend money on machine translation, or don’t want to go through the hassle of signing up and paying recurring fees, there is an alternative: the yandex API. It works with 30 languages, including Arabic, Azerbaijani, Belarusian, Bulgarian, Bosnian, Catalan, Czech, Danish, German, Greek, English, Spanish, Estonian, Finnish, French, Hebrew, Croatian, Hungarian, Armenian, Indonesian, Icelandic, Italian, Georgian, Lithuanian, Latvian, Macedonian, Malay, Maltese, Dutch, Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Slovenian, Albanian, Serbian, Swedish, Thai, Turkish, Ukrainian, Vietnamese, Chinese. It is an easy-to-use API: signing up and requesting an API key took me under 3 minutes....
Background noise
I found this simple but great idea on addcss.com. If you’re designing a “grungy” feeling web site, you can add some background noise to elements. This can easily be done with an inline transparent noise-png and a CSS-rule to set the right color. .grunge { background-color: #EF8; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQE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uOX7PeMRUERVaPpEs+yqeoSmuOlokqw49pgomjLeh7icHNlG19yjs6XXOMedYm5xH2YxpV2tc0Ro2jJfxC50ApuxGob7lMsxfTbeUv07TyYxpeLucEH1gNd4IKH2LAg5TdVhlCafZvpskfncCfx8pOhJzd76bJWeYFnFciwcYfubRc12Ip/ppIhA1/mSZ/RxjFDrJC5xifFjJpY2Xl5zXdguFqYyTR1zSp1Y9p+tktDYYSNflcxI0iyO4TPBdlRcpeqjK/piF5bklq77VSEaA+z8qmJTFzIWiitbnzR794USKBUaT0NTEsVjZqLaFVqJoPN9ODG70IPbfBHKK+/q/AWR0tJzYHRULOa4MP+W/HfGadZUbfw177G7j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYg!...
@import in CSS: no space
I tortured myself over a particular piece of emptiness. Not the existential void we’re thrown in by our creator, but the space I put before url in @import url ("../twentytwelve/style.css"); This is for wordpress stylesheet development, and with the space, the child theme doesn’t load up the parent style.css. I just corrected it to @import url("../twentytwelve/style.css"); and it’s working fine. I hope that this post if useful for whoever just stumbled upon it. ...
Monday, June 23, 2014
Internal Server Error 500: check PHP Boost
If your Google Search just yielded this result I hope it will be useful. I had an Internal Server Error on only *one* of my WordPress Multisites (3.9.1) and went through the standard debugging process – .htaccess, switching off plugins, resetting theme, error logs – to no avail. I have no caching plugin installed because it’s still kind of a development site. But… My hoster (strato) uses a PHP code caching mechanism called PHP Boost. Switching it off in their configuration dashboard solved the problem instantly. ...