Done.

Seems that keeping 3000 posts and 10,000 images updated takes about half a blog lifetime.

I moved from Movable Type to WordPress in 2009, and ditched ecto, the old blogging app, about the same time. Over the years, I wrote SQL queries, grepped the hell out of the database, redesigned the whole website (while keeping the same black and white aesthetic), recoded stuff, wrote some hella shonky redirections, and slowly went through all the posts turning images into galleries and using WordPress’ Featured Image, and then gave up on it all a couple of years ago before getting weirdly ‘inspired’ this weekend and doing 1000+ posts over the course of 2 days.

My database queries tell me all the galleries are now correct, and all the single images also. A stupid amount of work I hope I never have to do again, because I know my singular, obsessive focus will do it. Legit, my wrist is going ”WTF, Frances, WTfuckingF.” and if I keep blogging like this, eventually maintenance will take longer than there is days in a year.

After many years of supernaut images being tiny wi…

Status

After many years of supernaut images being tiny with ragged right background captions, I’ve been slowly ditching it for supernaut teenage Instabanga big images. And finally I cleared out all the old styles and code, made new medium and large image galleries, redid the styles and scripts repeatedly, said goodbye to funky bodges. Kept the blazing deep pink tho’. ???❌?‼️

A Bit of Character Counting Stupidity

When I’m using WordPress’ Status Post Format, I like to keep it to 140 characters, so it’s like a Tweet. But how many characters have I typed? Cos The Visual Editor only shows Word Count. So I took a look around and saw various ways of doing it, quite a few using regex to strip ‘unwanted characters’—but a space counts as a character! So I wrote my own, based loosely on what I’d been using for counting characters in the Excerpt, and from a few different plugins and bits of code. Turned out to be surprisingly easy and uncomplicated (I say that now, of course).

So, first I need a function to call a couple of files if I happen to be editing a Post or Page:

function supernaut_character_count( $charcount ) {
  if ( 'post.php' == $charcount || 'post-new.php' == $charcount ) {
    wp_enqueue_style( 'character-count-css', get_stylesheet_directory_uri() . '/css/char-count.css', array() );
    wp_enqueue_script( 'character-count-js', get_stylesheet_directory_uri() . '/js/char-count.js', array( 'jquery' ), '20160519', true );
  }
  else return;
}
add_action( 'admin_enqueue_scripts', 'supernaut_character_count' );

Then I slap together some jQuery:

jQuery( document ).ready( function( $ ) {
  if( $( '.post-php' ).length || $( '.post-new-php' ).length ) {
    $( '#post-formats-select input' ).click( function() {
      if ( $('#post-format-status').is(':checked') ) {
        $( '#post-status-info tr:first-child' ).after( 'Character count: 

‘ ); $( ‘#content_ifr’ ).ready( function () { setInterval( function() { var tinymcebody = $( ‘#content_ifr’ ).contents().find( ‘body’ ); $( ‘#postdivrich .character-count’ ).html( tinymcebody.text().length ); }, 500 ) }); } else { $( ‘#post-status-info tr:first-child’ ).nextAll().remove(); } }); } });

Then a miniscule bit of CSS:

.post-php #wp-character-count {
  font-size: 12px;
  line-height: 1;
  display: block;
  padding: 0 10px 4px;
}

It’s a little bodgy, and if I had more than the 45 minutes to a) work out how the Visual Editor can be fiddled with, and b) write something that worked and looked ok—the bare minimum really—I’d do it slightly nice and maybe consider for a minute throwing it into a plugin (where it officially belongs). But I won’t. It does what I want: live updating of how many characters I’ve written in the Visual Editor, and shows it in a line underneath the Word Count (also aided me in delaying writing a residency application on the day it’s due).