left-pad
left-pad for WordPress
★ 2stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/w-biggs/wp-left-pad/archive/refs/heads/master.zipFrom the readme
wp-left-pad
Because programming sucks.
Installation
Download master.zip, then install it via the "Add Plugin" button on WordPress's "Plugins" page.
Usage example
Just use the shortcode in any WordPress text area. Easy peasy. A few examples:
Note: The third argument should be a single character. Obviously.
Release History
1.0
First proper release
CHANGE: Fix handling of multi-byte pad characters
0.1
Work in progress
Meta
Distributed under the WTFPL. Because who cares. See LICENSE for more information.
FAQ
Why?
I originally had the idea to do this after someone on Reddit joked about WordPress plugins being like node modules. I responded with a low-effort left-pad joke, but soon thought "hey, that might actually be funny to do!". It was a fun little exercise to spend a little time on.
Boooring. You just have to use strpad(), right?
Wrong. strpad() doesn't handle multi-byte characters correctly, and while I tried to replicate the functionality of left-pad as closely as possible, multi-byte characters needed to work correctly. Otherwise, I couldn't use non-breaking spaces (which are encoded as c2 a0 in UTF-8); I needed to use non-breaking spaces as WordPress aut