Page Mapping... RIP (When Your Business Case Eliminates a Feature)

So, I had two use cases for this subdomain mapping, and I figured out that one of these use cases isn't relevant, or it is really not relevant in the long term.

As always, business needs determine technical needs, though that can get lost when you're focused on code.

Domain Mapping with Page Mapping

I had one of those mornings and a little bit of the afternoon when I had to dig pretty deep into the code... wrote a lot of code, then trashed most of it.

My goal was to be able to map a subdomain to a page's permalink. This way, I can have map to

Hacking Multisite WordPress' Domain Mapping

I had been using the old WordPress MU Domain Mapping plugin for multisite WordPress, and was pretty happy with it, but unknown to me (because I only started reading WP blogs and groups this past year) WordPress has rolled this feature into the core.

WordPress Customizer selective Refresh and Partials for Multiple Settings

There are several good references about how to set up the Customizer to avoid refreshing the entire page with each change. here, and there's some deeper explanation here. What's not described much is how to map several settings to a single area of the page (called a Partial).

This tutorial will go into updating Partials that use several settings. I assume you have already done the other tutorials.

Observing the WordPress Customizer (wp.customize) Events

I needed to learn a little about the events triggered in the Customizer, and came up with a little script that does that.

WP's Customizer's weird IFRAME Glitch

I'm not sure if this is a bug, but it's so odd that I'll leave a post here to remind myself about this. The Customizer has an odd behavior if you enter it via the big blue button on the Admin dashboard that reads "Customize Your Site".

Random Rabbitholes about IFRAMES and WP's Script Loader

My script was working, but it wasn't loading correctly the first time. I had to reload to make it run. Unacceptable.

I spent a full day going down a lot of interesting rabbitholes, but ended up finding a really simple, almost obvious, solution. That's a good thing, but the torturous journey is the reward.

WP's Backbone-like Templating Language

In yesterday's post, I talked about fixing up old PHP code to be safer.

There's another anti-pattern common in old PHP code, and that's mixing the display logic with the output logic. While some of this is inevitable, nowadays, the rule is to use a templating system like Twig to separate out even small bits of HTML code from the logic.

WordPress does this on the front end via Underscore templates, but configured to use Handlebars-like syntax.

This is a PHP class that does the same thing with PHP.

filter_var? filter_input? No, Use Filter Input Array.

I've been a real nut for filter_var() for years, and have come up with concise ways to use it, but totally missed this other function, which, at first look, seemed a little too specialized.


Well, I was so wrong. This is a great way to filter inputs. I figured this out when I had to fix up some code because it was throwing a zillion "Notice, index foobar not defined." in the error logs.

That's what happens when your legacy code looks like this:

$bar = $_GET['bar'];

all over the place, and it's not defined.

Greasemonkey/ Tampermoney Ebay Seller Script to Filter Active Listings

I wrote another script at Greasyfork. Here's my profile.

This one adds a "filter" feature to the ebay selling list so you can quickly find specific items.

Greasyfork is a repository of scripts for Greasemoney and Tampermoney, web browser extensions that allow you to execute your own Javscript code on any web page.

This means you can create elements, insert them onto the page, and do automate some repetitive tasks.

Export eBay Active Listings as Text (csv)

Go to your active listings.

Set the listing length (at the bottom of the page) to a high number so all your items are listed.

Check off the box that selects all the rows.

Click "Edit" button, to go to the editor that alters multiple items.

Check off the box that selects all the rows.

Under the "Action" menu, select "Export to file". From there you can choose CSV or PDF.

WordPress Study

I'm studying the library, and Backbone.js. I never really did anything with except toy programs with Backbone - and I didn't really grok it, so now I can learn it... post Angular and post-React. It's going backwards in time, but, still instructive because the Backbone.js idioms are different from the easier-to-use frameworks. Tutorials, and wp.Backbone. Subviews

I'm still working on reading through the WP media code, but found several references that have helped.

Syndicate content