Tag Archives: micro.blog

WordPress menus fixed, fault mine & mine alone⤴

from @ wwwd – John's World Wide Wall Display

I just updated my blog to the latest version of WordPress.

All seemed fine until I had a look at the site. Some of my menus had went a little weird.

Quite a few of the titles had changed to ellipses! I went into the dashboard and changed them back, my changes didn’t stick. I presumed that it must have been the upgrade. I had no idea where to start so shot off a quick tweet for help.

After dinner I calmed down a little and though about the changes to my blog I’d made recently for mico blogging. One of those was to give posts without a title titles on wp_insert_post_data. It uses ellipse! This was meant for posts arriving from the micro.blog app. They would get titles set when they arrived on my blog, to prevent ugliness in he dashboard.

function modify_post_title($data)
    if ($data[ 'post_title' ] == ''  ) {
        //wp_filter_nohtml_kses strips html and then I replace   
        $title = str_replace( " " , " " , substr( wp_filter_nohtml_kses( $data[ 'post_content' ] ) , 0, 60 ) ) . "..." ;
        $data['post_title'] =  $title ;
    return $data; // Returns the modified data.

so I’ve changed the if to:
if ($data[ 'post_title' ] == '' && $data[ 'post_type' ] == 'post' )

Which seems to have solved the problem and taught me a lesson.

wwwd – John's World Wide Wall Display 2017-05-08 20:21:15⤴

from @ wwwd – John's World Wide Wall Display

I’ve been beta testing micro.blog. There is a new page here for status type posts, these get sent to micro.blog/johnjohnston and to twitter.

This has renewed my interest in finding different ways to post to the blog especially for short posts that would have previously gone straight to twitter.

On iOS there is the nice micro.blog app, editorial or drafts and workflow. On my mac I’ve used AppleScript to post to blogs before, but needed to figure out how to add a category for the micro blog. I also wanted to not have a title, use the format of status and the note kind. The categories and kinds were the tricky bit, they need to be in a strut within a strut in the datas sent to the xml-rpc end point (I am a wee bit wobbly on the vocabulary here).

The following script does the trick. It is fairly limited as I hard code various things into it:

  • user name
  • password – this is probably not the greatest idea.
  • the category micro
  • the post format and kind
  • an empty title

It should be obvious how to change most of these things and make the script fit other needs or to generalise it.

I also wanted to be able to post from any application, so this script is for Alfred. In a workflow this is triggered by a hotkey which sends the currently selected text to the script. The script passes on the returned info, the post id, to a notification.

So to post a quick stratus method I select some text  hit cmd-alt-control-m and that test gets posted here.

Of interest to micro.blogista is the comment_status:"open" bit. I am thinking of all sorts of ways to extend this, perhaps for use in FastScripts to grab the selecting and link from Safari. I’d have probably used FastScripts for this, but I can’t figure out how to get the selection from any text in plain AppleScript, I needed Alfred for that.