02/12/2020

The archive contains older posts which may no longer reflect my current views.

# Ah, the morning battle with spam email - nothing quite wakes you up like it. I create multiple spam filters which catch some of it but also tweak the threshold on the server in an attempt to find the sweet spot which catches as much as possible without generating false positives. It's a game of cat and mouse where I feel like the Tom to spam's Jerry.

# The more I use the new setup the more I like it. Having a unified posting experience with inline editing and all content filters available across the whole site (both blog and garden) is like a dream.

Love means never having to use wp-admin!

And it's only by really using something that you can make it better; I keep finding little quality of life tweaks to add such as adding a live word count to the blog (just like the garden) so I can keep track while posting.

I have also added a new search filter to pre_get_posts so that those searches conducted within the garden only finds results from those pages. Firstly, I added a hidden field to the search form called 'source' and set the value to garden, then filter the query to only return page that use the garden template:

function SearchFilter($searchquery)
{
$source = $_GET['source'];
    if ($searchquery->is_search && $source == 'garden' ) {
        $searchquery->set('post_type', 'page');
        $searchquery->set('meta_key', '_wp_page_template');
        $searchquery->set('meta_value', 'garden_template.php');
    }
    return $searchquery;
}

add_action('pre_get_posts', 'SearchFilter');

Works like a charm.

# Oh, and how could I forget full sorting of the garden home page by modified date including children and grandchildren rather than just parent pages. It's only a small thing but it's a nice touch.

# Check your T's & C's:

There is only one letter difference between “medication” and “meditation.” - Elliston Roshi

# Today should be a watershed: it is the first day out of England's second lockdown and we are back on the tiered system. Still, it makes little difference as far as I am concerned - an excess of caution is still the order of they day. That the UK government has approved the Pfizer Covid vaccine, and the first doses should be available next week, is huge. It will take months for wide-scale distribution so we can't quite see the light at the end of the tunnel but at least we know we are in a tunnel so the light can't be too far away.

# Theoretically, I can insert new sections at any point of a day (maybe I want to continue a thought) and the RSS feed itself will not be impacted. What would happen, however, is that a change in order would mean that the individual permalinks would start pointing to the wrong sections.

When I add a new section I should, therefore, be able to assign it a section number, write that to the database and construct the permalinks based on that. A query would be able to retrieve the latest section number from the database and then increment this for each new section.

Iteration...

# I think I've got a lot of the mechanism in place so this update will be the acid test. If the section number is correctly written to the database and follows sequentially from the previous one then we're in business.

# A number was written to the database, just not the right number. I think it's because I had the instruction in the wrong place. But we're half way there.