Roel asked if there was a post detailing how I set up the posting form. There is now...

Firstly, I've slimmed down the form a bit further by adding placeholder values rather than labels and adjusting the spacing. It now takes up less room at the top of the page. I've also added a toggle to show/hide the form with a quick bit of JavaScript and CSS.

Post Form

So, how does it work?

It's all relatively straightforward.

As mentioned yesterday, the elements are contained within if (current_user_can('edit_posts')) checks. The original form page had everything permanently visible but required a "key" to be entered so that only I could post. With this now being at the top of the home page (unless your default is the Today view) I obviously don't want it visible all the time. Hiding it with the current user check also means I can do away with the key.

The form is just regular HTML with its method set to "post" and no action so that it redirects back to the same page on submit. Inspired by micro.blog, the Title field is only shown if I change the post format to 'Post' rather than 'Status'.

Once submitted and after a quick sanity check I pull the required form values from the standard PHP $_POST variable and set up my core details:

$title = stripslashes($_POST['title']);
$body = stripslashes($_POST['body']);
$status = $_POST['status'];
$format = $_POST['format'];
$author_id = '346';
$comment_status = 'open';
$ping_status = 'open';
$post_date = gmdate("Y-m-d H:i");

If I am sending a "Like" webmention I enter the URL and the required text is added to the post as per my "Likes and Replies plugin" so I won't go in to those details here. Suffice it to say that this uses a custom field on posting.

With all the information in place I construct an array of 'post data'

$post_data = array(
  'post_type'      => 'post',
  'post_title'     => $title,
  'post_content'   => $body,
  'post_status'    => $status,
  'tax_input'      => array('post_format' => $format),
  'post_author'    => $author_id,
  'comment_status' => $comment_status,
  'ping_status'    => $ping_status,
  'post_date_gmt'  => $post_date,
);

and then use this at the parameter to insert a new post

$postID = wp_insert_post($post_data);

If the post is a draft I then redirect to the post preview, otherwise I just stay on the Daily page which will then have the shiny new post.

And that's it - there's not much to it and it's simpler than with the standalone page.

If I did decide to go the AJAX route things would get considerably more complex but I don't think I really need to. Besides, I've not done anything of that ilk for what seems like an eternity.

Status

Yesterday was our youngest daughter's birthday although it seems almost a misnomer to call her that. She was 20.

It's crazy that even our youngest is no longer a teen, instead a fully fledged adult.

I feel old.

Status

I'm happy to report that Google Keep is working out nicely on the watch. The Fossil Wellness app, however, has stopped syncing sleep tracking data to Google Fit so I'm going to have to take a look at that.

Status

I installed the latest dev build of NetNewsWire 5.1d3 and, although I've only had a few minutes to check it out, am enjoying it already. Feedly syncing is a feature I've been waiting for and I'm happy to report that (in my albeit limited testing) the sync has been solid.

The reader view and Hide Read Feeds/Articles make life a lot simpler by keeping the interface tidy.

Although Brent always warns that it's not even alpha so the 'd' could stand for "don’t or dangerous or demons live in this here code" it's a lot more stable than some 'live' apps.

Status

When not writing blog posts I've been using Simplenote as my basic day-to-day app for normal notes and lists, a decision that was made because it is cross platform. There is even a version for Wear OS although I've been having a problem with it not downloading.

Simplenote does pretty much what you would expect a notes app to do in this day and age, it even supports Markdown and posting to WordPress, but it sometimes feels a bit clunky and unfinished. For example, you can make a list of items with check boxes but there isn't an option for checked items to drop to the bottom of the list.

That may seem like a stupid complaint but I want to start using lists on ny watch when I go shopping and having checked items drop off is a handy feature on such a small screen.

Wear OS being a Google property I thought I would take a look at Keep Notes, I've not even given it a second thought recently as used to dislike it with a passion when it was first released. To my surprise and delight Keep has been given a major overhaul since those early days and is now a much better looking app with a lot cleaner interface. And yes, checked items drop to the bottom of a list even on the watch.

I think I'm sold.

Status