WordCamp Moscow 2016

I’m Konstantin Kovshenin, a WordPress core contributor, ex-Automattician, public speaker and consultant, enjoying life in the rainy UK. I blog about tech, WordPress and DevOps.

I do code review, training and consulting on WordPress performance, scaling and security. Schedule a call if you’re interested.

Subscribe to my newsletter and follow me on Twitter.

Recent Blog Posts

Cleaner Titles in WordPress

Quick Tip! What happens when your post title does not fit on one line? It wraps to the second line. What if it’s only one word? And what if that word is “it” or some other shorty? Your title won’t look too nice, eh? Here’s a solution, somewhere inside the loop: $title = the_title( '<h2>', '</h2>', false ); if ( strlen( $title ) > 0 ) echo...

Post Formats in WordPress: Breaking Down Those Quotes

Here’s a function that would grab the contents HTML and parse out the first quote (blockquote element) together with it’s cite (usually the quote author) and the remaining text that comes after the quote. This is useful for when dealing with the quote post format in WordPress. function get_blockquote() { $dom = new DOMDocument; $dom->loadHTML( apply_filters( 'the_content'...

MySQL Index Hinting

Did you know that you can give a hint to MySQL on which index to use? It’s called Index Hint and can be part of a query where you feel MySQL is doing a wrong choice (although that’s quite unlikely these days.) SELECT * FROM table1 USE INDEX (your_index) WHERE col1 = 1 AND col2 = 2 AND col3 = 3; Where your_index is the name of the index you’d like to use for this query. You can...

Encode Entities Inside PRE Tags

Here’s a little Python script that searches through a given file for pre tags and encodes anything in between. This is useful for when escaping from syntax highlighting plugins and replacing every occurrence of the code shortcode with a pre tag. import re, sys # First argument is the filename, output is filename.encoded filename = sys.argv[1] f = file(filename) output = open('%s.encoded' %...

Regex Replace in MySQL or lib_mysqludf_preg in Ubuntu Linux

I’ve been working a lot with MySQL lately, especially after the major theme and plugin upgrades on my blog. I was dealing with a bunch of content issues like redundant shortcodes and post meta, URL changes, images directories and more. One simple solution would be to grab the database dump, perform various search and replace operations and then feed it back in, and my goal was to do that...

External Links with CSS3 or jQuery

Here’s how I marked external links using CSS throughout my blog with a few simple selectors one of which is a level 3 meaning this solution will probably fail in some version of IE and other browsers with limited CSS3 support. a { background: url('') right center no-repeat; padding-right: 14px; } a[href^=""], a[href^="/"], a[href^="#"] { background: none; padding-right: inherit; } The first...

New Plugin: Posts Screen Excerpt

New Plugin: Posts Screen Excerpt — makes an excerpt column available in the All Posts screen in WordPress. Useful for when working with posts without titles, where (no title) doesn’t say much about which post you’re about to edit.

Google’s Halloween Doodles throughout the years

Mashable has posted Google’s Halloween Doodles throughout the years starting all the way back from 1999. Today’s doodle is definitely one of their best so far, then again, is it wise to put so much effort into a one day video? Happy Halloween everyone!

WordPress Posts Without Titles in RSS feeds

Some RSS readers and aggregators will display things like “no title” or “untitled” for posts without a title in WordPress, which looks pretty awful. I’ve been playing around with post formats lately and things like links, quotes and images are fine without titles sometimes, but at other times they do require a title, so we can’t just “disable/hide”...

Delete Cached Copy in Capistrano

Quick tip! If you’ve changed the Git repository for your project and deploying via Capistrano while using cached copies you might get a “doesn’t exist” error because your cached copy is still pointed at the old Git repository. You can fix this by manually logging into your application server, browsing to the shared directory and deleting the cached-copy directory...