This is a note to self in case this happens again…
Today we discovered that the custom CSS on a WordPress site had disappeared. The whole section was empty and the site looked a bit shonky around the edges.
I had backups, but didn’t want to go restoring before first seeing if there was a “lighter touch” way to restore the custom CSS.
I had no idea where the custom CSS was stored in the database, so I took a hammer to crack the nut. Did a mysqldump and opened it in an editor. Quickly found that it wasn’t stored in wp_options, instead it was in wp_posts.
The custom css is stored like a normal post and so has a bunch of revision history records. This query showed me what was stored and from what date:
select post_status,post_modified from wp_posts where post_content like '%custom_css%';
I then pulled back the most recent CSS:
select post_content from wp_posts where id = XXX;
The settings are stored in a JSON string:
{
"custom_css[astra-child]": {
"value": "... CUSTOM CSS HERE ..."
}
I couldn’t quite cut and paste the CSS since it had “\n” newlines in it. So I simply cut and pasted the string into a quick two line python script:
css = "pasted custom CSS"
print(css)
Which gave me what I needed. I’m sure that there’s an easier way, but it did the trick. Pasted the CSS back into the settings and we were good to go.
Anyone who knows me will confirm that I’m not the most outgoing of people. I tend to work in the background and try and help others. I think it’s that IT support and developer ethic of getting the job done rather than taking the credit or whatever.
Still, over the past couple of years that’s had to change with the work that we’ve been doing at Awesome Tech Training. I had run lectures and training before, but especially since the COVID outbreak we’ve been running online webinars and training, which have been equally terrifying and really interesting.
We ran a couple last Friday which I presented – for “Why Choose WordPress” and the one that I was really interested introducing people to the idea of speed and performance improvement in WordPress.
Had I got back to blogging here earlier, I would have posted a link. Instead I’ll just say that it was the most interesting set of webinars so far, for me. Hopefully we’ll run them again soon if anyone is interested.
And if you want to find what webinars we’re running in the near future, we have them listed on our Upcoming Webinars page.
I had to write a few words for Awesome Tech Training and I realised that the first record of my WordPress journey was in this blog back in 2005. Back then I was a local councillor at West Lancs District Council and so I was writing about what was happening in the Moorside ward in Skelmersdale.
That’s long past but it seems a shame to leave this lying unattended.
These days I’m spending more time showing people how to use WordPress and writing code. So some things are different, some things stay the same. But now seems as good a time as any to start updating here again.
I’ve been bad and haven’t updated this blog in about five years.
Quite a bit has happened.
So it seems like a good time to pick up the site, dust it down and start posting stuff again.
Also, I’ve moved it away from the transitory domain, kiemiestas.com, and am back at stevehanlon.co.uk. Anything work related can be found over at stevehanlon.com, but to be honest, it just has a holding page at the moment. This isn’t the only site that has been neglected over the past few years.
Our journey back started early. I was keen to get a walk done before we started travelling, so I was up and out before 8. I would have been out earlier, but I didn’t want to be out walking in the dark, so I left the villa 15 minutes before sunrise so that I could watch the dawn. It was beautiful. The birds were singing and there were several cockerels crowing as I pottered by.
I walked down to the beach, took a few photos and then headed back. Just about 3km and a 30 minute walk before waking the children to finish packing.
I think we packed everything except the cans of coke that were in the fridge and I’d planned on drinking before we got to the airport.
Lily had been keen to see the sink hole by the lighthouse, so we first took a detour for a look down the hole and some more photographs.
Mum was also keen to see Vilamoura which had been featured on a TV programme recently, so we stopped off there for a drink and breakfast sandwich in a bar by the beach. It’s about 30 years since we were last there and back then it felt like it was overdeveloped. Now it has the feeling of a large new town or a city. I’m glad we stayed where we did, Carvoeiro is relatively undeveloped and still has a feel of a small town.
When we went out for dinner last night we had a look for a place near Rocha Brava which is a short walk from the villa. The first place we tried was a delightful little place that looked super-tasty, but it turned out they only took cash — and I’d done a good job of spending every last bit of cash before we left. We’ll be back, especially to try the pork and clams.
Instead we went to the restaurant in the Rocha Brava complex. When we looked at the menu we were prepared to be disappointed as the options looked like something that we’d have at home, but it turned out to be delicious. Another place to go back to.
Yesterday was also supposed to be bad weather, but in the end, all the rain fell overnight and the day was clear and warm. There was much playing in the pool and sunny pottering. We walked down into town in the morning, had a coffee and then walked back – two slow walks for my 107th day.
Braving the cliffs on the way back
So I’m writing this on the plane, heading back and looking forward to seeing Jude and getting back into the various projects that need to be completed. It’s going to be a busy few weeks ahead.
It’s nearly time to leave. The weather is turning cool again and the packing and flight home are imminent.
I’ve had “sort out shit before we go home” on my list of things to do since the weekend, but there has been stuff that has taken precedence. Walks, chats, that kind of thing. Today was going to be the time to do something, but the flicker of working mojo was extinguished by an email that needed urgent attention. Probably for the best, but I really do have one task that I need to sort before the end of tomorrow. I’m hoping that the apocalyptic storms tomorrow will mean that I get a moment to sort it out.
The walks have continued, but it’s been hard to find the time for the running. “Steve, stop being a lazy arse and get out there” — I hear you say, and you have a point.
The spirit is willing but the flesh is very weak. Or the flesh is willing but the spirit is weak. Oh, or the flesh is weak and the spirit is weak. Probably the latter. Bottom line is that it’s been difficult to drag myself away from the tasty bread rolls and the beer in order to do some training.
I ran on Sunday. 5k around the block, which actually felt good given that it also felt like it was 100 degrees (it wasn’t). Yesterday was hotter and when I got up I realised that it was genuinely too hot for a run, so I took a much longer walk — into town and back again. Today, I was just being very rubbish. I walked with the children to Rocha Brava but we were busy in the morning and in the afternoon and it just didn’t work. There are other reasons, dear reader, but I can explain those when I catch up with you next (if you’re interested!)
For the most part, that’s where we’re up to. Left to my own devices I could quite easily get mountains of stuff done, and it’s tempting to imagine a week away here by myself alone with just my laptop and to-do list. In the moments when I’ve been alone, albeit briefly, the silence and calm has been breathtaking. I’ll miss that as much as the sun, sea and fresh air. That said, I’ve got virtually nothing work-related done, and that’s almost certainly a good thing. We’ve goofed around in the pool, chatted, walked and relaxed for two weeks. It’ll be busy enough when we return.
I’ve lost track of what day it is now. Jude headed back home today, so I’m pretty certain that it’s been Saturday all day, although it’s felt like a Sunday. I think…
Lorna and Matthias went back home on Thursday, battling bravely with the thousands of others who were delayed because of the French air traffic controllers strike. My parents were delayed as well — arriving at Faro at about midnight. I should have been nicely tucked up in bed, tummy full of beer; instead I was sipping a strong coffee in the arrivals section of the airport.
So far, it’s been a lovely couple of days since they arrived. My last walk with Lorna was along a boardwalk into Carvoeiro down to the town centre before heading back up the hill on the other side. My walk yesterday was with Jude and Joel to the lighthouse and the sink hole (yes, they have everything here!) Today’s walk was with my parents, down to the beach and back up again, while Jude packed her bags for her return journey.
Jude was heading back early because of her Africa trip earlier in the year. She didn’t many days holiday left and so we decided that it was probably better for me to stay out here with the kids and for her to go back to work.
She very nearly didn’t get to the airport on time. The rental car wouldn’t start (for a long time) and I seriously thought that we were in the zone for booking a taxi. My Dad managed to start the car while I was digging out the paperwork, and so we got to the airport and I was able to get the car replaced. All good.
Then I’ve spent the rest of the day reading by the pool and playing with 3D models. There’s a long blog post in this, once I’ve got my head around how the different parameters seem to work. In the end, I uploaded a bunch of photos for Ivan to do some photogrammetry and turn them into a 3D head and shoulders image. The best that I’ve been able to get usually has a great blob of wall or tiles poking out the top of my head. I’ll post fun pictures later — but only once it all works.
Tomorrow will be warm again, by the looks of it. There will also be a run, it feels a long time since the last one.
Yesterday was the end of the first week. A day of end-of-the-world rain turned out to be a day of glorious sunshine.
Lorna and Matthias were heading off at lunchtime, so we got a walk done as soon as breakfast was complete. This was my 102nd walk, having completed my 100th the other day (and not blogged about it — bad Steve). We went along the clifftop walk, down into town back up the other side and then came back again. The walks have been all about the hills and yesterday was no different. Possibly the most scenic of the walks, it was a pleasant way to end the walks with Lorna.
Lorna, mid-walk.
I’m not sure if anyone will be out with me in week 2. I suspect that I’ll mostly be pottering out my myself. Certainly this morning I may be alone, as the skies are grey and rainy just at the moment.
The rest of the day yesterday was spent mostly driving around and shuttling people to and from the airport. Our first run at lunchtime was to take L&M back, and a later run to pick up my parents, who eventually arrived at midnight. The French air traffic controller strike made everyone’s journeys difficult and uncertain yesterday.
It was late when I finally got to bed, about 2am, so we’re all running a bit late today. A more comprehensive update later, hopefully when the sun comes out.
Happily, today has again been much better than anticipated. It was cloudy, but the rain held off mostly. This morning Lorna and I took an almost-4km walk around this part of town. The earlier walks had been up and downhill — along the cliffside walk or with the children, so the 30 minutes were coming in at 2.7-ish km. We needed a long walk to get the cumulative distance up again, and we rebalanced it a little today.
Given the cloudier weather, we decided to go out for a day trip to Silves. It is about 20 minutes drive away and has a wonderful castle perched on a hill, surrounded by an old town full of cobbled streets.
Lily and Joel at Silves
We had a good potter around the castle and then visited Rui’s fish restaurant in the town. A place where we often visited when we were younger, but haven’t been to in well over 10 years. The place hasn’t changed in 30 years, from the cheap tables and chairs, to the tanks with lobsters and crabs waiting to be cooked and scoffed. The only difference that I could tell, was that the TV was now flat-screen rather than the old wooden box that previously hung on the wall.
We were caught in a downpour when we left the restaurant, but that was about as bad as it got. It cleared up as we drove back and was fine within half an hour.
About an hour later, Matthias and I headed out for a 10k run. I’d planned a route which would take us around this development, then down some country lanes into Carvoeiro town centre and then back up along the main roads and the hills to the villa. This all looked good until I took a wrong turn about 1.5km into the run and we ended up in the middle of some luxury development with large villas either side and no-where to go except turn back and retrace our path back. There was some quick re-planning of the route which seemed to work alright. We got to the end of the drive precisely at 9.68km which, weirdly, was the planned distance for the day.
It had been warm and mostly dry with the occasional spot of rain — which came as a welcome relief because the whole route was up and downhill. Runkeeper tells us that the elevation was 207m, and it could have been much more given that it felt like we were endlessly going uphill. At least we might have burned off some of the very many bread rolls that we’ve scoffed over the past few days.
Plus it didn’t kill me, which is a relief. Nor did jumping into the pool when we got back (which felt awesome, btw!)
No BBQ tonight. Instead we went into town and ate at Martin’s Grill, a place in the main square overlooking the beach. Nothing much to report, except that it was a very pleasant evening: tasty food, good fun and the children enjoyed themselves. All good.
The other fun thing I’ve been playing with today has been trying to get a 3D model of Lily built correctly. This is an exercise in understanding some of the tools used. Earlier attempts had failed – probably because of how I had been capturing images, but I decided to just turn on the burst camera on my iphone and then use the images that came out of it to see what I could build. The model looked like it was going to take 34 hours to build (on a quad-core SSD macbook pro, so it goes quite fast), so I did a first pass using the lower resolution algorithms in PhotoScanPro and cleaned using Meshlab. I’m quite pleased with how it turned out, but have now created a batch job to see if I can do it at a better resolution. Hopefully the higher resolution model won’t have a hole in the back of Lily’s head!
I’d put a copy of the scan here, but I’m struggling to put together the right files to upload at the moment. The materials file doesn’t seem to upload in the zip properly (this is a sketchfab thing, not a shapie issue at the moment). Instead here are some snaps:
The low-res model in meshlabs:
and the corresponding model in sketchfab without, apparently, the materials file.
It didn’t rain like it was the end of the world today. We were braced for it, but while the clouds were with us most of the day, it was mostly hot, dry and enjoyable weather. The Apple weather, BBC and Weather Channel are all united in telling us that the next four days will be rainmageddon, but that shouldn’t stop us enjoying our time here.
As with previous updates, there is very little to report on. Between breakfast and lunch we went for a run — which I had mis-remembered as being relatively flat for the most part, except for a large downhill and a corresponding long uphill stretch. The run actually felt like 80% uphill, 19% downhill and about 1% flat. This is not good when running in the heat.
Matthias, Lorna and I headed off for what was supposed to be a steady / slow run which I misjudged completely. I thought that I had pottered off at a steady pace, but it turns out that I had gauged the start completely wrong and regretted it for the last 500m. I really need to learn to go slower for the slow paced runs.
We walked as well. The six of us headed out around a circuitous route to the beach via the local Spar and a quick visit to acquire some charcoal bricks for the BBQ later. We enjoyed some beers and ice cream at the O-Stop before pottering back to the villa for more beer, card games, outdoor meat cooking and time in the pool. [don’t bother with the link, btw, they’re just collecting emails, sadly]
The day was rounded off with a good old discussion about local / national politics, the election, federalism and proportional representation (well, these were the bits that I was enjoying). Sadly curtailed way too soon thanks to too much fresh air and time for bed.