Porchy Web Development

all of the things Category

Updating Webpack to use WordPress editor blocks (Gutenberg blocks) on the front end (part 4 of 4)

Getting blocks running on the front end is, or should be, mainly a matter of updating Webpack to create the script to run on the front end, then enqueuing it so it does. However, I’ve always found it requires some fixing of things that don’t work quite right together, that I’ve misnamed or otherwise mismatched …

The Click Game

The click game. I’m including this now because I would like to test it before the last post on how to make it. 😬😊

Setting up wp-browser with WPWebDriver for full site acceptance testing (notes for my future self)

These are my notes on getting WPWebDriver in wp-browser set up to work for me. They supplement rather than replace the wp-browser documentation. If you are having issues and haven’t started there and followed the directions, I highly recommend doing that first. Inifinum also has a super helpful section on setting up wp-browser.

Using a scaffold to build Gutenberg blocks for the WordPress editor (part 1 of 4)

Block scaffolds are being created, updated or going out of date at a regular rate these days as developers figure out what works best for them. So instead of making a recommendation on which one you should use, I’m going to tell you what I looked for – what was important to *me at the …

WooCommerce Subscriptions: not able to purchase subscription after failed payment [edited on 2021-01-27]

This is a workaround and fix for the following situation which occurs in recent versions (<3.0.12) of WooCommerce Subscriptions. When purchasing a subscription which is limited to “any” (ie a user can only have one subscription of any status), the user cannot pay for a failed order as the subscription product gets removed from their …

Adding Gutenberg / WordPress editor blocks to the front end

People love to play with a little web app on a site. Quizzes, small games, anything to take a break for a minute or two. Wouldn’t it be great to be able to add and edit these in the WordPress editor then reuse the React components on the front end? Yes! The answer is yes. …

Vue single file components stop loading css after update

Spoiler: the issue is in the css-loader update and the fix is outlined here. The css-loader needs the esModule: false option. My final webpack.config.js looks like this: More on the issue I was updating an old-ish (3 years) Vue app which had been updated but not regularly. I got everything working again as you do …

WordPress Editor blocks as web apps in Gatsby

This is a proof of concept web app, completely editable in WordPress using the block editor. I think it’s more fun to do it first. (Please let me know if these don’t work, they’re version 0.1. Saving them will save to your browser only.) Fill in the blanks then click “your poem” to see your …

Manually adding a Let’s Encrypt certificate to my Okta custom domain using certbot locally

Massive caveat: Currently (24 July 2020) Okta does not support automatic Let’s Encrypt certificates and renewals for custom domains. So I’ll have to do this <= 89 days from now again. Which is why I’m writing it down. Ideally this post will not be needed soon because Okta will set up one click, auto renewing …

Regex, Netlify, Gatsby and swapping links

caveat: this is an “I don’t really know what I’m doing but it’s working, so….” post. This blog is on Netlify and uses Gatsby to build it from the a WordPress install (I’m typing this on the WP install, it’ll get built by Netlify and published there.) Because I’m a lazy sod, I’m just leaving …

Adding conditional menu items to WordPress menus

Here’s what I wanted to do: give clients the ability to add conditional items to menus and be clear about which users will see which items on the front end menu. For example, I want some menu items which only show for logged in users and some which only show for users who have bought …

What use is anything without columns

As expected, Gutenberg blocks with inner blocks, eg columns, weren’t working. Like other bits, this was somewhat straightforward once I figured out how. It took me a while and with more than a few infinite loops thrown in to make it that much more frustrating. What I ended up is copying the render_blocks function from …

Gutenberg and Gatsby sitting in a tree…

This is about WordPress and the static site generator Gatsby, not the Gutenberg and Gatsby you might know. I’m not sure where that post would go. Anyway. Parsing Gutenberg blocks in Gatsby turns out to be much more straightforward than I thought it would be. Not that it’s completely straightforward, but I didn’t find it …

WP blocks, raw data and the auths

I’m at the point now where I want to try parsing the raw content of the posts with the new editor / Gutenberg block data. The endpoints with posts in both the REST API and wp_graphql contain a field with the data needed but that’s only accessible to users with the edit_posts and maybe a …

Shortcodes? WP Blocks? Server side rendering?

I have a Prism.js block that I quite like, it’s part of a series of goofy ass Gutenberg blocks I made so long ago they probably don’t even work anymore. They’re working again. Most of it was Gutenberg backwards compat breaks, some was other back compat breaks, some was forgetting what I did in the …

Using Gutenberg blocks in place of custom metaboxes in WordPress

Custom metaboxes are used extensively in WordPress for layout purposes as well as data structure. However, they don’t necessarily — in fact they rarely — save to the meta key’s array of objects when they’re added to the WordPress REST API and can’t be used by Gutenberg’s built in meta attribute. How can we use Gutenberg with …

register_meta(), register_rest_field() and the WP REST API

There are two standard ways to add additional data into a post’s object in the WP REST API: register_meta() for post meta which is a string, number or boolean and register_rest_field()for everything else. There’s a bit on the difference between the two in the REST API docs. With Gutenberg, register_meta() is being used more widely and there’s …

Iterating over an array of objects which I desperately want to be reactive in Vue.js

[a note to my future self from my current self as of 17 April 2018: are you here again? Is there definitely a unique key on that loop? Are you sure? GO PUT ONE ON NOW. Use the uuid package, it’s easy. Then come back if it still doesn’t work.] This took me a while yesterday …

The Mandelbrot set visualised in golang

[note on 07 April 2018: I wrote this in late September 2017 but never published it. I think it’s not finished but useful up until that point so I’m publishing it now] This is a deeper dive into the Mandelbrot exercises in Chapter 3 of The Go Programming Language (Addison-Wesley Professional Computing Series) (that’s an affiliate …

Using Select2 with ajax with CMB2 repeating groups

No idea if the title makes sense. I wanted a Select2 which uses a remote data source queried via ajax with a CMB2 repeating group so made a plugin to understand it better. It’s pretty heavily commented so I don’t forget why I did what I did. There are definitely a few if not many …

Using custom tables with CMB2

This is more straightforward than I expected (yay thank you @jtsternberg). The short of it is to add a filter to cmb2_override_meta_value or cmb2_override_{$a[‘field_id’]}_meta_value to get the data and cmb2_override_meta_save to save it. But what if I have a repeatable group huh? What then?

A talk on community management and tech support

I gave a talk at WordPress London in May about dealing with people who use your website, tech support and community management. Can I embed my slides? No I cannot. You can find my slides here. There’s a video of the talk on the WordPress London Facebook page, but you’ll need to request to be a member. …

Gutenberg wish list

Ok, this is without really looking at it so maybe it has these. identifiable non-global blocks (so not these: https://github.com/WordPress/gutenberg/issues/2081) because I want to maybe use postmeta with a block? I don’t know, I have this vague idea that I’m too lazy to articulate atm. ok this wasn’t bad, I’ve done this. the ability to limit …

scraping http POST requests with golang

One of the #enumerateallthethings projects in Go. PostScrape lets you scrape targeted html nodes in enumerateable http POST requests. It uses goquery for the targeting. Currently it’s command line only. Works but not finished at all, needs tests and other things. (Part of a larger project where I just needed the data.)

Improving Gravatar (the service)

The problem: Gravatar hashes are somewhat easy to crack. Websites are super easy to scrape. Sites with Gravatar urls in the img-src or profile link make it trivial to generate lists of hashes to crack. Other data available on sites and in Gravatar profiles can be used to generate targeted wordlists which make cracking a …

Windstream compatible modem for a non-bonded connection

When my Windstream modem was repeatedly power cycling when trying to connect, tech support said this was the modem letting me know it was damaged and needed to be replaced. They offered to rent me a modem for $10/month but oh my god no, why would I do that? This one lasted me over 10 …

A Slack bot that gets the last three posts from a WordPress site

This Glitch project grabs the latest three posts for WordPress sites which are using either the WP REST API or the WP.com version via Jetpack. It uses MongoDB for persistence. It’s not super exciting or well written but a fairly effective way to mindlessly try sites on Slack and see if they have the WP …

So what’s the difference between WordPress filters and hooks?

Understanding what filters and actions do took me forever, ok, maybe not but longer than I’d care to admit at any rate. It wasn’t the fault of the resources I found, it was just that I couldn’t get my head around it. But one day, PING! I got it. Here is how I understand them. …

Porchy Ltd is a company registered in England, no. 12035925

VAT Registration no. 331196421

Built with WPGraphQL and Gatsby

© 2019 - 2021